I am trying to figure out how to use the supposed reporting capabilities of JUnit (3 and 4) in conjunction with Maven, but Google searches aren\'t turning up much in the way
The Maven Surefire Plugin is the plugin that runs tests and generates 2 raw reports by default:
The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in 2 different file formats:
- Plain text files (*.txt)
- XML files (*.xml)
By default, these files are generated at
${basedir}/target/surefire-reports
The plugin has some parameter allowing to tweak the reports a bit. From the surefire:test mojo documentation:
For an HTML format of the report, you can then use the Maven Surefire Report Plugin:
The Surefire Report Plugin parses the generated
TEST-*.xml
files under${basedir}/target/surefire-reports
and renders them to DOXIA which creates the web interface version of the test results.
You can either get the report generated as part of the site generation or by running the standalone surefire-report:report
goal. From the Usage page:
Generate the report as part of Project Reports
To generate the Surefire report as part of the site generation, add the following in the section of your POM:
... ... org.apache.maven.plugins maven-surefire-report-plugin 2.5 When the
mvn site
is invoked, the report will be automatically included in the Project Reports menu as shown in the figure below.
(source: apache.org)Generate the report as standalone
The Surefire report can also generate the report using its standalone goal:
mvn surefire-report:report
A HTML report should be generated
in ${basedir}/target/site/surefire-report.html
.
(source: apache.org)