简体   繁体   中英

Cucumber tests in parallel with Junit and Gradle?

I'm trying to run cucumber feature files in parallel using Junit as described in official documentation[https://cucumber.io/docs/guides/parallel-execution/#junit], but in my project I use Gradle instead of Maven and don't know how to implement this part:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
    <configuration>
        <parallel>methods</parallel>
        <useUnlimitedThreads>true</useUnlimitedThreads>
    </configuration>
</plugin>

Gradle does not support parallel execution below class level. So with Gradle and JUnit 4 you can not run Cucumber in parallel.

With Gradle and JUnit 5 this is not a problem as JUnit 5 will handle parallel execution. You will however have to use Cucumbers JUnit Engine:

https://github.com/cucumber/cucumber-jvm/tree/main/junit-platform-engine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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