简体   繁体   English

Cucumber-testng 4.0 并行执行总是默认为 10

[英]cucumber-testng 4.0 parallel execution defaults to 10 always

Here is my cuke runner.这是我的 cuke runner。 I am trying to use inbuilt parallelism built in cucumber-jvm 4.0.0 by overriding dataprovider method.我正在尝试通过覆盖 dataprovider 方法来使用黄瓜 jvm 4.0.0 中内置的并行性。 I see that my scenarios are invoked in parallel however the thread count defaults to 10 always.我看到我的场景是并行调用的,但是线程计数始终默认为 10。 I tried executing with --threads options as state in GitHub but it doesnt work.我尝试在GitHub 中使用 --threads 选项作为状态执行,但它不起作用。

mvn test -Dcucumber.options="--tags @test --threads 3"
mvn test -Dcucumber.options="--threads 3"

Tried both but still 10 threads are spawned by default.两者都试过,但默认情况下仍然产生 10 个线程。 What am i missing here?我在这里缺少什么? I know there are others ways to achieve parallelism in cukes using temyers plugin or qaf 3rd party plugin.我知道还有其他方法可以使用 temyers 插件或 qaf 3rd 方插件在 cukes 中实现并行性。 But my question is very specific to native parallel support of cucumber-jvm 4.0.0 What am i missing here in my CLI cucumber options?但我的问题是非常具体的对黄瓜 jvm 4.0.0 的本地并行支持我在我的 CLI 黄瓜选项中缺少什么?

   package cuke.runner;

    import org.testng.annotations.DataProvider;

    import cucumber.api.CucumberOptions;
    import cucumber.api.testng.AbstractTestNGCucumberTests;

    @CucumberOptions(features= {"src/test/resources/features"},glue="com/sd")
    public class TestRunner extends AbstractTestNGCucumberTests{
        @Override
        @DataProvider(parallel=true)
        public Object[][] scenarios() {
            return super.scenarios();
        }
    }

The default thread count of the dataprovider in parallel mode is 10. To change this the dataproviderthreadcount property needs to be added to the configuration section of the Surefire or Failsafe plugin in the POM.并行模式下 dataprovider 的默认线程数为 10。要更改此值,需要将 dataproviderthreadcount 属性添加到 POM 中的 Surefire 或 Failsafe 插件的配置部分。

<configuration>
    <properties>
        <property>
            <name>dataproviderthreadcount</name>
            <value>20</value>
        </property>
    </properties>
</configuration>

Cucumber-JVM allows parallel execution across multiple threads since version 4.0.0. 自版本4.0.0起,Cucumber-JVM允许跨多个线程并行执行。 There are several options to incorporate this built-in feature in a Cucumber projects and running the feature files directly from the command line using the cucumber.api.cli.Main class. 有多种选项可将此内置功能合并到Cucumber项目中,并使用Cucumber.api.cli.Main类直接从命令行运行功能文件。 Refer to this - https://github.com/cucumber/cucumber-jvm/blob/v4.0.0/core/src/main/resources/cucumber/api/cli/USAGE.txt 参阅此-https://github.com/cucumber/cucumber-jvm/blob/v4.0.0/core/src/main/resources/cucumber/api/cli/USAGE.txt

在命令行中传递参数-Ddataproviderthreadcount=1000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM