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:
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