Hi Karl Heinz,

thanks for getting in touch.

Am 24.09.2026 17:36 schrieb Karl Heinz Marbaise via users:
Hi,

On 24.09.26 16:06, Björn Raupach wrote:
Hi there,

I am tinkering with the recent versions of Surefire and JUnit 6 and can't figure out how to make parallel execution work.

With the following pom.xml the test cases run sequentiell. I expected otherwise.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http:// maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>

     <groupId>org.example</groupId>
     <artifactId>foo</artifactId>
     <version>1.0-SNAPSHOT</version>

     <properties>
         <maven.compiler.source>25</maven.compiler.source>
         <maven.compiler.target>25</maven.compiler.target>

Here I would recommend to use
<maven.compiler.release>25</maven.compiler.release>
instead.

Yes. Will do. The pom.xml was generated with IntelliJ IDEA. New project. So if someone from JetBrains is reading this. This might be a good change.


<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>

     <dependencyManagement>
         <dependencies>
             <dependency>
                 <groupId>org.junit</groupId>
                 <artifactId>junit-bom</artifactId>
                 <version>6.1.3</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
         </dependencies>
     </dependencyManagement>

     <dependencies>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>

     <build>
         <plugins>
             <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>3.6.0</version>
                 <configuration>
                     <parallel>all</parallel>
                     <useUnlimitedThreads>true</useUnlimitedThreads>
                 </configuration>
             </plugin>
         </plugins>
     </build>


<parallel> is for the TestNG provider (which does not exist anymore;
could be documented better)

https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#parallel

and

<useUnlimitedThreads> is for JUnit 4 provider which does not exist anymore

https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#useunlimitedthreads

I am sorry. Totally my fault. I was reading the documentation at https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html and not reading the documentation of the goal at https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html. I missed Junit 4 in the text. Thanks for pointing this out.



</project>

If I change the configuration and configure JUnit 6 directly I can make parallel execution work, but I don't think that is the intended way or am I mistaken?

[..]
<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
   <version>3.6.0</version>
   <configuration>
     <properties>
       <configurationParameters>
         junit.jupiter.execution.parallel.enabled = true
         junit.jupiter.execution.parallel.mode.default = concurrent
       </configurationParameters>
     </properties>
   </configuration>


That is the way to go. Or you can put a
rc/test/resources/junit-platform.properties[1] file which will be
picked up as well..

Perfect. Thank you very much.



[1]
https://docs.junit.org/6.1.3/_exports/junit-user-guide-6.1.3.html#writing-tests-parallel-execution

Kind regards
Karl Heinz Marbaise

</plugin>
[..]

Here is my java and maven version:

Apache Maven 3.9.16 (2bdd9fddda4b155ebf8000e807eb73fd829a51d5)
Maven home: /Users/raupach/.sdkman/candidates/maven/current
Java version: 25, vendor: Eclipse Adoptium, runtime: /Users/ raupach/.sdkman/candidates/java/25.r25-mandrel
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "27.0", arch: "aarch64", family: "mac"


with kind regards
Björn




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to