3

我的项目中有一些TestNG测试与jUnit测试一起运行。每个人都和平共处,事情按预期运行,直到有一天,事情不是一直在工作,而是在某些时候工作。

当运行mvn clean install测试达到

Configuring TestNG with: TestNG652Configurator

并被卡住。从那以后似乎什么都没有发生。

当运行mvn -X clean install测试到达完全相同的点而没有问题(顶部没有错误)并且拒绝进一步移动时。

我在用

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
    </dependency>

    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
    </dependency>

请问这里会发生什么?

4

1 回答 1

4

我从未见过 Surefire(运行测试的插件)从 JUnit 和 TestNG 开箱即用地运行测试,尽管它应该这样做。

您可以通过强制提供程序来强制确保运行 JUnit 和 TestNG,如此所述。例如,以下将强制 TestNG 和 JUnit 4.7

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.13</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-junit47</artifactId>
      <version>2.13</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-testng</artifactId>
      <version>2.13</version>
    </dependency>
  </dependencies>
</plugin>

可能影响结果的另一件事是您是否已将 TestNG 配置为运行一些测试组。

于 2013-02-20T16:12:04.790 回答