Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a decent HTML Junit report plugin for Maven?

I find the surefire-report plug-in very unsuitable to my working style. I clean the project all the time and I don't want to spend 5 min to rebuild the whole site every time I want to look at the test report in my browser.

If I type mvn surefire-report:report-only, the generated report is too ugly and barely readable.

What I'm looking for is something like ant's JUnitReport task. Is there one available out there already?

like image 537
Y.H Wong Avatar asked May 17 '10 03:05

Y.H Wong


People also ask

Can JUnit generate HTML report?

By default, JUnit tests generate simple report XML files for its test execution. These XML files can then be used to generate any custom reports as per the testing requirement. We can also generate HTML reports using the XML files.

Which maven dependency should you use to generate HTML unit test report?

We can use maven-surefire-report-plugin plugin to generate HTML based reports for our JUnit tests.

How do I customize a JUnit report?

The junitreport task uses XSLT to produce the report from the XML files generated by the junit task. For customizing the the output, one option would be to make a copy of the default XSLT and modify that. Or you could look for an alternative XSLT which is more easy to customize for your purposes.


1 Answers

This is what I do:

# Run tests and generate .xml reports mvn test  # Convert .xml reports into .html report, but without the CSS or images mvn surefire-report:report-only  # Put the CSS and images where they need to be without the rest of the # time-consuming stuff mvn site -DgenerateReports=false 

go to target/site/surefire-report.html for the report.

After tests run, the rest of the two run in about 3.5 seconds for me.

Hope that helps. Enjoy!

like image 61
prasanna Avatar answered Sep 22 '22 19:09

prasanna