Generating unit test reports

The Maven Surefire plugin is executed in the "test" phase of the build lifecycle to run the unit tests, generate plain text, and XML reports of the tests.

The Surefire plugin comes with one goal: surefire:test.

By default, Surefire reports can be found in {basedir}/target/surefire-reports.

Getting ready

To get started, you need to include the dependency of the Maven Surefile plugin in your project POM.xml file.

<project> ... <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.6</version> </plugin> ... </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> ...

Get Apache Maven 3 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.