简体   繁体   English

如何设置cucumber testng框架并行执行的线程数?

[英]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.

相关问题 Cucumber-testng 4.0 并行执行总是默认为 10 - cucumber-testng 4.0 parallel execution defaults to 10 always 如何在各自的测试文件夹中为每个测试生成 cucumber.json(我使用的是 Cucumber 5,它使用 Z0F10ECB7756532AE8DAE8CA448 进行并行执行) - How to generate cucumber.json per test in respective test folders (I am using Cucumber 5 which uses TestNG for parallel execution) 如何在执行期间使用TestNG和Java设置方法的调用计数 - How to set invocation count during execution for the method using TestNG & Java 在多线程执行期间使用TestNG生成Cucumber ExtentReport - Cucumber ExtentReport generation with TestNG during multiple thread execution 如何使 spring 批处理步骤执行与可配置的线程数并行? - How to make spring batch step execution parallel with configurable thread count? Cucumber框架如何正确使用TestNG注解 - How to use correctly TestNG annotations with Cucumber framework 如何在并行执行中将参数传递给 TestNG 侦听器? - How to pass parameters to TestNG listeners in parallel execution? 如何在 testNG 并行执行中重用驱动程序 - How to reuse the drivers in testNG parallel execution testNG并行执行不起作用 - testNG parallel execution not working TestNG 中的并行执行 - Parallel Execution in TestNG
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM