Maven-surefire插件,不包括并行测试

时间:2020-06-21 00:07:33

标签: maven testng cucumber-jvm maven-surefire-plugin cucumber-java

我正在使用maven-surefire,黄瓜和testng并行运行一些黄瓜测试,我想并行执行一些测试和串行执行一些测试。 PS-我不是使用testng.xml,而是使用testrunner.java来运行测试。

致谢

2 个答案:

答案 0 :(得分:1)

您可以在pom.xml中并行设置。需要添加具有线程数和并行(方法,类等)的配置

示例:

</plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <parallel>methods</parallel>
          <threadCount>10</threadCount>
        </configuration>
      </plugin>
    [...]
</plugins>

答案 1 :(得分:0)

请参阅注释 @NotThreadSafe 和文档https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html 正是这个问题得以解决。它与JUnit 4一起使用-而不是TestNG和JUnit5。

相关问题