Maven doesn't execute any unit test
Rename test files from **Tests.java
to **Test.java
or add the following configuration to pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
</plugin>
Additionally, one more cause for such a behaviour is if you have an exclusion for junit-vintage-engine
in your pom.xml
dependencies.
In my case I had excluded it from the spring-boot-starter-test
dependency in my pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
This resulted in the same problem. Maven not able to recognize/find any test cases in the project even though they are present.
So just remove the exclusions section and run the maven command again.