我正在使用maven-surefire, cucumber和testng并行运行一些cucumber测试,我想并行执行一些测试,并按序列顺序执行一些测试。PS-我没有使用testng.xml,但使用testrunner.java来运行我的测试。
问候
您可以在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>
请参阅注释@NotThreadSafe和留档https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html这个问题正好解决了。它与JUnit 4一起使用,而不是TestNG和JUnit5。