David M. Karr created SUREFIRE-2040: ---------------------------------------
Summary: When moving from JUnit 4 to JUnit 5, with some JUnit 4 tests remaining, Surefire is unable to execute a test suite from the command line Key: SUREFIRE-2040 URL: https://issues.apache.org/jira/browse/SUREFIRE-2040 Project: Maven Surefire Issue Type: Bug Components: JUnit 5.x support Affects Versions: 3.0.0-M5 Reporter: David M. Karr 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: <?xml version="1.0" encoding="UTF-8"?> <project ... <dependencyManagement> <dependencies> <dependency> <groupId>org.junit</groupId> <artifactId>junit-bom</artifactId> <version>5.8.2</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-junit-jupiter</artifactId> <version>4.4.0</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-suite-api</artifactId> </dependency> ... </dependencies> <build> <plugins> ... <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> <reuseForks>false</reuseForks> <redirectTestOutputToFile>true</redirectTestOutputToFile> </configuration> </plugin> ... </plugins> </build> </project> -- This message was sent by Atlassian Jira (v8.20.1#820001)