cucumber / cucumber-jvm

Cucumber for the JVM
https://cucumber.io
MIT License
2.7k stars 2.02k forks source link

How to contoller the threadcount for the cucumber parallel execution ( version :cucumber-jvm 4.2.6)? #1609

Closed kevinchan114 closed 5 years ago

kevinchan114 commented 5 years ago

I don't know how to contoller the threadcount for the cucumber parallel execution. I have set the threadcount in the pom.xml file, but it not work! please help me~!

below is the information: cucumber version : 4.2.6, I use it's parallel fuction, 1、pom.xml setting:

<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>4.2.6</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>4.2.6</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>4.2.6</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>4.2.6</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <parallel>both</parallel>
                <threadCount>2</threadCount>
            </configuration>
        </plugin>
    </plugins>
</build>

2、RunCukesTest:

public class RunCukesTest extends AbstractTestNGCucumberTests {

@DataProvider(parallel = true)
@Override
public Object[][] scenarios() {
    return super.scenarios();
}

}

In this configuration , the threadCount is 2,but it does not work,all the scenario parallel execute at the same time. Then i try to edit the pom, change the maven-surefire-plugin config like that:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <properties>
                    <property>
                        <name>dataproviderthreadcount</name>
                        <value>2</value>
                    </property>
                </properties>
            </configuration>
        </plugin>

It also does not work,all the scenario parallel execute at the same time.

who can help me?

mlvandijk commented 5 years ago

Please use the support forums for questions and discussions. We use GitHub issues to track bugs and contributions exclusively.

sirdir commented 5 years ago

@kevinchan114 yes you need to use dataproviderthreadcount and it's work fine maybe you need to specify surefire plugin version

here are working POC https://github.com/sirdir/pom_parallel_testng

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.