JUnit HTML Report
We can use
maven-surefire-report-plugin plugin to generate HTML based reports for our JUnit tests. This report can be exported and shared with the team. It’s also an easy way to understand how your tests went through, especially when you integrate them with CI tools like Jenkins.
There are two steps to generate JUnit HTML report from our maven project.
mvn sitecommand from the terminal. It will generate HTML reports in
surefire-report.html file in the browser. You will get an output like below image, it’s from my JUnit Examples project.
Some of the useful information we get from JUnit HTML report are:
- Test Packages and Classes
- Test Methods names from specific classes
- Failure tests or skipped tests with reason
- Execution time taken by each method
TestNG supports built-in HTML report generation whereas JUnit HTML reports are generated by maven surefire plugin and we have to execute an additional command for it. However, JUnit HTML reports look much better when compared to TestNG HTML reports.