哼着我实际的pom的一部分。 已经在@Test注释中为集成测试的Testng测试分配了一个“集成”组。 为了做一点测试,我没有在测试阶段排除“集成”组。
使用例如mvn verify或mvn install进行构建时,集成测试将在测试阶段执行,而不是在验证或集成测试阶段执行。 测试的次数仍为0.不知怎的,它们没有被提取。任何人都知道可能出现的问题?
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.1</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12.1</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludedGroups>unit</excludedGroups>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
<configuration>
<skip>false</skip>
<excludedGroups>unit</excludedGroups>
</configuration>
</execution>
</executions>
<configuration>
<skip>false</skip>
<excludedGroups>unit</excludedGroups>
</configuration>
</plugin>
更新:添加TestNG作为故障安全插件的依赖项不会 帮助
答案 0 :(得分:12)
maven-failsafe-plugin仅包含与following patterns匹配的文件:
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
您是如何命名测试类的?