Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1918

Parallel execution doesn't work with junit-vintage-engine

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.22.2, 3.0.0-M5
    • None
    • None
    • Apache Maven 3.8.1

    Description

      Tests don't get executed in parallel with JUnit's vintage engine.

      The following configuration executes them serially:

      <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>5.7.2</version>
       </dependency>
      
      ...
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M5</version>
        <configuration>
          <parallel>methods</parallel>
          <useUnlimitedThreads>true</useUnlimitedThreads>
        </configuration>
      </plugin>

       

      Replacing the vintage engine with Junit 4 executes tests in parallel as expected:

      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
      </dependency>
      

       

      I have attached a minimal failing example. mvn test will produce the following output:

      [INFO] -------------------------------------------------------
       [INFO] T E S T S
       [INFO] -------------------------------------------------------
       [INFO] Running ParallelTest
       Test 1 running in main
       Test 2 running in main
       Test 3 running in main
       Test 4 running in main

      The expected output (and what I get with JUnit 4) would be:

      [INFO] -------------------------------------------------------
       [INFO] T E S T S
       [INFO] -------------------------------------------------------
       [INFO] Running ParallelTest
       Test 1 running in pool-2-thread-1
       Test 3 running in pool-2-thread-3
       Test 4 running in pool-2-thread-4
       Test 2 running in pool-2-thread-2

      Attachments

        1. parallel-tests.tar.gz
          1.0 kB
          Martin Schneider

        Activity

          People

            Unassigned Unassigned
            martinschneider Martin Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: