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?
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.
We can use maven-surefire-report-plugin plugin to generate HTML based reports for our JUnit tests.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With