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

maven-surefire-plugin with reuseForks=false doesn't find any tests in JUnit Jupiter 5.3.0

    Details

      Description

      This issue was originally reported against JUnit (see https://github.com/junit-team/junit5/issues/1579 ). Christian Stein noted that all the code for the integration resides in the Surefire repo, closed the original issue and requested one be reported here.
      He also noted that https://github.com/apache/maven-surefire/pull/193 , intended to solve SUREFIRE-1564 may fix the problem. Reading through the issue description this doesn't look like an exact duplicate, so I'm reporting the original issue here too - if the same fix addresses both that's great, but just wanted to have this problem on your radar.

       

      When using a combination of JUnit 5.3.0 together with maven-surefire-plugin 2.22.0 configured with reuseForks=false, surefire fails to find any JUnit tests.

      Downgrading JUnit to 5.2.0 makes it work (i.e., tests are properly found), as does setting reuseForks=true.

      The pom.xml file:

      <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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.example</groupId>
        <artifactId>junit.jupiter.reuse-forks</artifactId>
        <packaging>jar</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>junit.jupiter.reuse-forks</name>
        <url>http://maven.apache.org</url>
      
        <dependencies>
          <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.3.0</version> <!-- If replaced by 5.2.0, the test executes -->
            <scope>test</scope>
          </dependency>
        </dependencies>
      
        <build>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.22.0</version>
              <configuration>
                <reuseForks>false</reuseForks> <!-- If replace by true, the test executes -->
              </configuration>
            </plugin>
          </plugins>
        </build>
      </project>
      

      A complete example is available in the attached zip file. just unzip and run mvn install.

       

      With JUnit 5.3.0, you'll see the output:

      Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

      With JUnit 5.2.0, you'll see the expected output:

      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

        Attachments

        1. reuser-forks.zip
          2 kB
          Allon Mureinik

          Issue Links

            Activity

              People

              • Assignee:
                tibor17 Tibor Digana
                Reporter:
                mureinik Allon Mureinik
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: