You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Miguel Almeida <mi...@gmail.com> on 2012/03/13 20:30:31 UTC

Surefire + failsafe plugins - how to generate reports?

Dear all,

I was using surefire-report to test my multi-module Maven project, by
running the goal "clean surefire-report:report" on the parent project.

However, some Cucumber BDD tests were slowing the tests down (4+ minutes),
which is not good if we want devs to run them frequently. Ideally, what I
want is:
- quick set of tests run locally
- full set of tests run in CI (Jenkins)

I decided to try the failsafe plugin, so I changed one test from
Acceptance_Test to Acceptance_IT and added the following in the parent pom.

                <plugin>
>                     <groupId>org.apache.maven.plugins</groupId>
>                     <artifactId>maven-failsafe-plugin</artifactId>
>                     <version>2.12</version>
>                     <executions>
>                         <execution>
>                             <id>integration-test</id>
>                             <goals>
>                                 <goal>integration-test</goal>
>                                 <goal>verify</goal>
>                             </goals>
>                         </execution>
>                     </executions>
>                 </plugin>
>

Sure enough, mvn verify runs the IT test and surefire-report:report (or mvn
site) runs the other ones.

I added the following [1] to the reportPlugins section of the
maven-site-plugin, but if I run "mvn site" I don't see my integration tests
in the [each_module]/target/site/surefire-report.html document, nor in
[each_module]/target/surefire-reports

[1] - section of the maven-site-plugin configuration

> <plugin>
>                             <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-surefire-report-plugin</artifactId>
>                             <version>2.12</version>
>                             <reportSets>
>                                 <reportSet>
>                                     <id>unit</id>
>                                     <reports>
>                                         <report>report</report>
>                                     </reports>
>                                 </reportSet>
>                                 <reportSet>
>                                     <id>integration-tests</id>
>                                     <reports>
>
> <report>failsafe-report-only</report>
>                                     </reports>
>                                 </reportSet>
>                             </reportSets>
>                         </plugin>
>


My questions are:
1) *which goal(s) do I have to run to have an html report for both sets of
tests?*
2) *Will it be one report with all tests, or two separate reports?*

I also have a couple of questions regarding the different goals run in CI
(I take it I should run all the goals in CI and only surefire:report on
developer's machines) and how Cobertura is affected by this (I read that
code coverage won't take into consideration the failsafe tests, even though
it should in the CI server), but I'll tackle one problem at a time.

I appreciate your help,

Miguel Almeida