17.08.2016 Views

Apache Maven 3 Cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4<br />

Generating unit test reports<br />

The <strong>Maven</strong> Surefire plugin is executed in the "test" phase of the build lifecycle to run the unit<br />

tests, generate plain text, and XML reports of the tests.<br />

The Surefire plugin comes with one goal: surefire:test.<br />

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

Getting ready<br />

To get started, you need to include the dependency of the <strong>Maven</strong> Surefile plugin in your<br />

project POM.xml file.<br />

<br />

...<br />

<br />

<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-surefire-plugin<br />

2.6<br />

<br />

...<br />

<br />

<br />

<br />

<br />

org.apache.maven.plugins<br />

maven-surefire-plugin<br />

<br />

...<br />

<br />

<br />

...<br />

<br />

You may also need to change the default configuration to suit your preferences. Configuration<br />

elements can also be included as depicted:<br />

<br />

org.apache.maven.plugins<br />

maven-surefire-plugin<br />

81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!