You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Allon Mureinik (JIRA)" <ji...@apache.org> on 2018/09/07 07:29:00 UTC

[jira] [Created] (SUREFIRE-1566) maven-surefire-plugin with reuseForks=false doesn't find any tests in JUnit Jupiter 5.3.0

Allon Mureinik created SUREFIRE-1566:
----------------------------------------

             Summary: maven-surefire-plugin with reuseForks=false doesn't find any tests in JUnit Jupiter 5.3.0
                 Key: SUREFIRE-1566
                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1566
             Project: Maven Surefire
          Issue Type: Bug
          Components: JUnit 5.x support, Maven Surefire Plugin, process forking
    Affects Versions: 2.22.0
            Reporter: Allon Mureinik
         Attachments: reuser-forks.zip

This issue was originally reported against JUnit (see [https://github.com/junit-team/junit5/issues/1579|https://github.com/junit-team/junit5/issues/1579)] ). [Christian Stein|https://github.com/sormuras] 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|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:
{code:java}
<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>
{code}
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}}{{}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)