[SUREFIRE-2040] No tests executed with junit-platform-suite and -Dtest=TestSuite (original) (raw)
My organization is in the process of moving their SpringBoot Maven builds from JUnit 4 to JUnit 5. Our "default" build runs all the unit tests. We also have "component tests" and "integration tests" that are specified in a "TestSuite" class. The build process specifies the name of the suite class on the command line with "-Dtest=ComponentTestSuite", for instance. Before the move to JUnit 5, this all worked fine.
In the move to JUnit 5, I modified ComponentTestSuite to be like this:
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@Suite
@SelectClasses(NoteResourceCT.class)
public class ComponentTestSuite
{ }
Now, when I run "mvn -Dtest=ComponentTestSuite test", it says the following:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project ...: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
There are no other messages.
My pom.xml basically looks like this:
<project
...
org.junit
junit-bom
5.8.2
pom
import
org.springframework.boot
spring-boot-starter-test
test
org.mockito
mockito-junit-jupiter
4.4.0
test
junit
junit
4.13.2
test
org.junit.platform
junit-platform-suite-api
...
...
maven-surefire-plugin
3.0.0-M5
false
true
...