2

咆哮我实际pom的一部分。集成测试的 Testng 测试已在 @Test 注释中分配了一个“集成”组。为了做小测试,我没有在测试阶段排除“集成”组。

当使用例如 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 添加为故障安全插件的依赖项无济于事

4

1 回答 1

13

默认情况下,maven-failsafe-plugin 仅包含匹配以下模式的文件:

<includes>
 <include>**/IT*.java</include>
 <include>**/*IT.java</include>
 <include>**/*ITCase.java</include>
</includes>

你是如何命名你的测试类的?

于 2012-08-17T22:37:55.183 回答