'JUnit5 - Parallel execution @ParameterizedTest

I try to make parallel execution using JUnit5 + Maven Surefire Plugin. For that I made some settings:

      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M4</version>
            <configuration>
                <properties>
                    <configurationParameters>
                        junit.jupiter.execution.parallel.enabled = true
                        junit.jupiter.execution.parallel.mode.default = concurrent
                    </configurationParameters>
                </properties>
            </configuration>
        </plugin>
    </plugins>

And it works correctly for test methods that marked annotation @Test. But I also have tests that marked annotation @ParameterizedTest and I expect that they should run in parallel using different values from the source. But it doesn't work as I expect - it runs in one thread. Is there possible to fix that or it is a feature in JUnit 5.



Solution 1:[1]

Use @Execution(ExecutionMode.CONCURRENT) tag along with @ParameterizedTest to run the scripts in parallel for the each set of data.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1