Hi!
I want to use maven-failsafe-plugin to run some integration tests. I want
Maven to run post-integration-test phase to tear down an application server.
If any test fails, I want Maven to fail the build so my CI server can pick
it up and inform the developer who just made a mistake.
My failsafe plugin is configured as:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/integration/**</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
This works fine, my app server gets set up and torn down. My integration
tests are executed properly. But when I add a JUnit test like this:
@Test
public void failingTest(){
fail("Expected to fail");
}
Maven doesn't fail the build.
I happily reports:
<lots of log output>
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
<lots of log output>
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 30.828s
[INFO] Finished at: Tue Oct 05 13:08:36 CEST 2010
[INFO] Final Memory: 15M/36M
[INFO]
------------------------------------------------------------------------
Do I need to set any additional property to get the maven-failsafe-plugin to
fail the build if a unit test failed?
Or am I trying to do something that the failsafe-plugin isn't done for?
I'm running Maven 3.0-RC3
mvn -version
Apache Maven 3.0-RC3 (r1001464; 2010-09-26 18:14:28+0200)
Java version: 1.6.0_21
Java home: C:\java\jdk1.6.0_21\jre
Default locale: sv_SE, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
/Thomas
--
Thomas Sundberg
M. Sc. in Computer Science
Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg
Better software through faster feedback