cucumber-testng 4.0 parallel execution defaults to

2019-07-15 12:26发布

Here is my cuke runner. I am trying to use inbuilt parallelism built in cucumber-jvm 4.0.0 by overriding dataprovider method. I see that my scenarios are invoked in parallel however the thread count defaults to 10 always. I tried executing with --threads options as state in GitHub but it doesnt work.

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

Tried both but still 10 threads are spawned by default. What am i missing here? I know there are others ways to achieve parallelism in cukes using temyers plugin or qaf 3rd party plugin. 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?

   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();
        }
    }

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-15 12:56

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.

<configuration>
    <properties>
        <property>
            <name>dataproviderthreadcount</name>
            <value>20</value>
        </property>
    </properties>
</configuration>
查看更多
登录 后发表回答