如何从xml报告生成cobertura html报告

时间:2015-01-13 18:02:00

标签: java jenkins cobertura

我想从cobertura xml报告中生成一个cobertura html报告。似乎Jenkins Cobertura插件可以做到这一点,但我无法弄清楚如何。我尝试了以下但它只生成部分html报告(取自CoberturaPublisher.java):

Set<String> sourcePaths = new HashSet<String>();
CoverageResult result = null;
try {
    result = CoberturaCoverageParser.parse(coberturaXmlReport, null, sourcePaths);
} catch (IOException e) {
    LOG.warn(format("Failed parse report %s", coberturaXmlReport.getAbsoluteFile()));
}

if (result != null) {
    result.setOwner(null);
    final FilePath paintedSourcesPath = new FilePath(new File(destinationDir)).child("html");
    paintedSourcesPath.mkdirs();
    // Get System default encoding;
    SourceEncoding encoding = SourceEncoding.getEncoding(System.getProperty("file.encoding"));
    OutputStream os = new FileOutputStream("XmlToHtml.log");
    BuildListener listener = new StreamBuildListener(os);
    SourceCodePainter painter = new SourceCodePainter(paintedSourcesPath, sourcePaths, result.getPaintedSources(), listener, encoding);
    final FilePath moduleRoot = new FilePath(new File(destinationDir));

    moduleRoot.act(painter);
}

我错过了什么吗?

0 个答案:

没有答案