我有一个在单元和集成阶段分组测试项目。 我有它运行buildbot,问题是,即使在测试失败的Maven返回码为0,因此buildbot构建是成功的。
这是MVN集成测试的结果:
Results :
Tests in error:
Info about failed tests
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 19 seconds
[INFO] Finished at: Tue Feb 12 09:43:53 UTC 2013
[INFO] Final Memory: 36M/97M
[INFO] ------------------------------------------------------------------------
$ echo $?
0
结果为MVN安装是没有建立成功部分结果是一样的:
Tests in error:
Info about failed tests
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0
$ echo $?
0
神火配置是这样的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<printSummary>true</printSummary>
<excludedGroups>com.testlib.IntegrationTest</excludedGroups>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<excludedGroups>com.testlib.IntegrationTest</excludedGroups>
</configuration>
</execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<groups>com.testlib.IntegrationTest</groups>
</includes>
</configuration>
</execution>
</executions>
</plugin>
我已经阅读有关行家返回代码,但在理论上相关的bug其他线程应固定在我的Maven版本(阿帕奇Maven的2.2.1(rdebian-8))
有没有什么办法改变这种行为?
更新:由于建议我试图与神火:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.13</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.13</version>
</dependency>
</dependencies>
<configuration>
<groups>com.testlib.IntegrationTest</groups>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</execution>
</executions>
我需要的神火,JUnit来避免初始化错误。