How to run parallel test jUnit5 in spring boot - cucumber version 5 and more

olegMoshneaga :

For test framework were used next stack of technologies: Java, Maven, Selenium, Junit, Cucumber, Spring Boot, YAML

cucumber.version = 5.4.0 Cucumber-JVM now has JUnit5 support and we can use parallel I have tried to add -Dcucumber.execution.parallel.enabled=true -Dcucumber.execution.parallel.config.strategy=dynamic

https://github.com/cucumber/cucumber-jvm/blob/master/release-notes/v5.0.0.md

was used :

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
                <includes>
                    <include>**/RunCucumberIT.java</include>
                    <release>11</release>
                </includes>
                <!--                    <parallel>methods</parallel>-->
                <!--                    <threadCount>4</threadCount>-->
            </configuration>
        </plugin>
mpkorstanje :

You can provide options by adding a junit-platform.properties file to your classpath root. For example:

src/test/resources/junit-platform.properties

cucumber.execution.parallel.enabled=true
cucumber.execution.parallel.config.strategy=fixed
cucumber.execution.parallel.config.fixed.parallelism=10

You can also pass options to the JUnit Platform via Surefires/Failsafes configurationParameters parameter field.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <properties>
            <configurationParameters>
                cucumber.execution.parallel.config.fixed.parallelism=24
            </configurationParameters>
        </properties>
    </configuration>
</plugin>

And because Cucumber is a JUnit Platform Engine you can also use any of the other ways you'd pass configuration parameter to the JUnit Platform.

Note that -D will not work because surefire starts a new JVM, you'd have to use `-DargLine='....' for this.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=198212&siteId=1