I have been trying to run unsuccessfully a single test in one class with Maven (version 3.3.9) and JUnit 5 (NOT 4) with the command:
mvn -Dtest=EmitRulesTest#cr_filter_contact_points_for_C4C_output test
This command executes all tests.
Trying out this command actually executes all tests in the class:
mvn test -Dtest=EmitRulesTest
This is my JUnit 5 Maven configuration:
<dependencies>
...
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.0.0-RC2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<systemPropertiesFile>${basedir}/src/test/resources/definitions/system.properties</systemPropertiesFile>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.0-RC2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.0-RC2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Further references: Running a Single Test using Maven
You can use this format:
You can find out more information here: http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html
This is an excerpt of my POM.xml