Maven execution
mvn clean test
I am trying to use junit5
for one of my maven projects but not able to execute the unit tests during the test
phase using -
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M3</version>
</dependency>
The output that I get is -
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ utils --- ------------------------------------------------------- T E S T S ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Tried implementing the solution mentioned @ Surefire is not picking up Junit 5 tests to update the dependencies to -
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M3</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit5-api</artifactId>
<version>5.0.0-ALPHA</version><!--https://mvnrepository.com/artifact/org.junit/junit5-api -->
<scope>test</scope>
</dependency>
and updating the plugin to -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>surefire-junit5</artifactId>
<version>5.0.0-ALPHA</version><!--couldn't find this on the central though-->
</dependency>
</dependencies>
</plugin>
but the output remains same.
Question - Is this custom provider no more supported or is there any solution to executing the tests using maven
, junit5
and/or junit5-api
currently?
Note - The test execution was working fine with JUnit-4.
You should configure the maven-surefire-plugin like this:
You only need to include the junit-jupiter-api artifact and only in test scope in your dependencies section:
Please see http://junit.org/junit5/docs/current/user-guide/#running-tests-build-maven for more information.
Edit - From the same docs.