[英]How to set the thread count in parallel execution of cucumber testng framework?
I would like to limit the parallel execution thread count in cucumber testng framework.我想限制 cucumber testng 框架中的并行执行线程数。 Now by default 10 threads (browsers) are getting started.
现在默认启动 10 个线程(浏览器)。
I am using cucumber-java and cucumber-testng version 7.8.0 and maven-surefire plugin version 3.0.0-M6.我正在使用 cucumber-java 和 cucumber-testng 版本 7.8.0 和 maven-surefire 插件版本 3.0.0-M6。 And testng version is 7.5
而testng版本是7.5
I tried setting thread configurations under maven-surefire-plugin but the same didn't work.我尝试在 maven-surefire-plugin 下设置线程配置,但同样不起作用。 Please help me to set the threadcount somewhere so that I can limit the no.
请帮我在某处设置线程数,以便我可以限制数量。 of parallel executions in cucumber framework.
cucumber 框架中的并行执行。
I have added the below code in my testrunner file to support parallel execution.我在我的 testrunner 文件中添加了以下代码以支持并行执行。
import org.testng.annotations.DataProvider;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(tags = "", features = "src/test/resources/features", glue = ""src/test/resources/teststepDefinitions")
public class CucumberRunnerTests extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
}```
You have to set dataproviderthreadcount
.您必须设置
dataproviderthreadcount
。 You can do this through surefire.你可以通过万无一失来做到这一点。
https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-testng#maven-surefire-plugin-configuration-for-parallel-execution https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-testng#maven-surefire-plugin-configuration-for-parallel-execution
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>dataproviderthreadcount</name>
<value>${threadcount}</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.