Java Reference
In-Depth Information
Figure 10.3
Execution of JUnit tests with Maven2
As you can see, we've specified the
includes
parameter to denote that we want only the
test cases matching the given pattern to be executed. Yes, but how do we know what
parameters the
maven-surefire-plugin
accepts? No one knows all the parameters by
heart, but you can always consult the
maven-surefire-plugin
documentation (and
any other plug-in documentation) on the Maven website (
http://maven.apache.org/)
.
10.3.3
HTML JUnit reports with Maven
As you saw in the previous chapter, Ant has a task for generating nice reports out of
JU
nit's
XML
output. The same thing applies for Maven. And because Maven, by
default, produces plain and
XML
-formatted output (by convention it goes into the tar-
get/surefire-reports directory), we don't need any other configuration to produce
HTML
Surefire Reports for the
JU
nit tests.
As you've already guessed, the job for producing these reports is done by a Maven
plug-in. The name of the plug-in is
maven-surefire-report-plugin
, and by default,
it isn't attached to any of the core phases that we already know (many people don't
need
HTML
reports every time they build their software). This means that we can't