Get your JUnit XML reports (e.g. from Jasmine) in readable HTML

Whether you do Test Driven Development or just write your tests last, hopefully you have a good unit testing suite covering your code. It is very likely that you end up with unit test results in the JUnit XML format. Here is a short snippet on how to convert your XML reports into readble HTML.

In my current project we have Gradle as a build tool, and since it is easy to use ant from there, we will use the nice JUnitReport. The main issue was getting the classpath right, and the solution to that was to redefine the ant task, so to pass the right path along.

In addition, if you are using Jasmine (e.g. under PhantomJS) which is currently still waiting for HTML reporting and you are using the JUnitXmlReporter, you end up with consolidated testsuites where several testsuite entries will be combined. Here the solution is to explicitly tell the reporter to omit that behaviour. 

Without further ado here is the Gist:

https://gist.github.com/2295010

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s