HtmlCoverageOutputter extends AbstractCoverageOutputter { @Override protected void exportCoverageInformation(IBPELCoverage c) throws IOException { String htmlFileName = c.getProcessName().getLocalPart() + ".html"; File htmlFile = new File(getOutputDirectory(), htmlFileName); HtmlWriter writer = new HtmlWriter(new FileWriter(htmlFile)); try { writer.startHead() .title("Coverage Report for: " + c.getProcessName().getLocalPart()) .stylesheet(stylesheet) .endHead(); writer.startBody(); writer.h1("Coverage Report for: " + c.getProcessName().getLocalPart()); for (IMetricCoverage metricCoverage : c.getMetricCoverages()) { writer.h2(metricCoverage.getMetricName()); writer.startTable(); writer.startTr() .th("Element") .th("Min") .th("Max") .th("Total") .th("Avg") .th("Coverage") .endTr(); for (ICoverageResult result : metricCoverage .getCoverageResult()) { writer.startTr() .td(result.getBPELElementReference()) .td(result.min()).td(result.max()) .td(result.getExecutionCount()).td(result.avg()).td(result.coverage()) .endTr(); } writer.endTable(); } writer.endBody(); } finally { IOUtils.closeQuietly(writer); } }  @CoverageOutputOption void setStylesheet(String stylesheetHref);  }
@Test public void testOutput() throws IOException { initializeOutputDirectory("testOutput"); DummyCoverage coverage = DummyCoverage.createDummyCoverage("testOutput"); doc.getCoverageInformationForProcesses().add(coverage); outputter.exportCoverageInformation(doc); File[] files = outputDirectory.listFiles(); assertEquals(1, files.length); assertEquals("testOutput.html", files[0].getName()); String actualContents = new String(FileUtil.readFile(files[0])); String expectedContents = new String(FileUtil.readFile(new File("src/test/resources/htmloutputter/testOutput.html"))); assertEquals(expectedContents, actualContents); }