Introduction
In this quick tutorial, I am going to show you how to create an HTML report of your JUnit tests using Maven.
Maven
You can use the maven-surefire-report-plugin plugin to help you create an HTML report of your tests. You need to add the following plugin to your pom.xml.
|
|
To generate the report use the following command.
|
|
When you added the plugin and ran the command you can find the JUnit html report inside the target/site directory.
Gradle
The Gradle Test task already creates an HTML report. You can find it in the directory target/report/tests/
.
Conclusion
This quick tutorial showed you how to generate an HTML report using Maven and JUnit. You only need to add a single plugin to be able to generate it. If you are using Gradle you only have to run the Test task which will generate a HTML report for you.