15

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

Leprosy
  • 1,085
  • 4
  • 14
  • 36

2 Answers2

7

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

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
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
Patrice M.
  • 4,209
  • 2
  • 27
  • 36
  • What if the xml file is from lcov-to-cobertura or such? – Penz Oct 13 '14 at 22:26
  • I would look into this python-based [specific-purpose tool](http://eriwen.github.io/lcov-to-cobertura-xml/) though I have not used it myself. – Patrice M. Oct 14 '14 at 14:30
  • 4
    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. – Penz Oct 14 '14 at 14:42
  • 1
    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) – Patrice M. Oct 15 '14 at 10:40