Is there a way to convert a Cobertura XML into an HTML report?
Asked Answered
D

2

16

I have a XML file generated in a test. Is there a way to convert it to a HTML report ala Jenkins?

Danialah answered 2/4, 2013 at 17:55 Comment(1)
An XSLT transformation?Conchology
P
7

pycobertura can take coverage.xml and convert it into reasonable-looking HTML. I'm using it with some Erlang source code right now.

Palais answered 21/6, 2019 at 20:32 Comment(0)
B
0

If you use Ant, you can use (notice 'format="html"'):

<cob:cobertura-report format="html" datafile="${cobertura.ser.file}" destdir="${todir}">
     <fileset dir="${srcdir}" includes="**/*.java"/>
</cob:cobertura-report>

With a maven pom, refer to: the manual, e.g.:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>cobertura-maven-plugin</artifactId>
   <configuration>
     <formats>
       <format>html</format>
       <!-- format>xml</format -->
     </formats>
   </configuration>
</plugin>

With a command-line script, refer to the manual too, e.g.:

cobertura-report.bat --format html --datafile C:\MyProject\build\cobertura.ser --destination C:\MyProject\reports\coverage C:\MyProject\src
Batts answered 1/10, 2013 at 16:15 Comment(4)
What if the xml file is from lcov-to-cobertura or such?Icehouse
I would look into this python-based specific-purpose tool though I have not used it myself.Batts
I'm already using hat to create the cobertura.xml from gcov tests - what I need is a way to generate the HTML reports from the cobertura.xml file.Icehouse
Oh I see. Sorry I misread the question. I gave .ser->html, you're asking xml->html. I can't find anything for that, nor the reverse engineering of the xml file into .ser (xml->.ser)Batts

© 2022 - 2024 — McMap. All rights reserved.