danny-v danny-v - 4 months ago 19
Java Question

Maven fail-safe not executing tests

Ok- I've combed S/O and many others, and have found all the other related posts and have followed all said suggestions, but in the end, failsafe is skipping my tests.

My JUnit test is here:
myModule/src/main/test/java/ClientAccessIT.java

I am skipping surefire because there are no unit tests in this module:

<!-- POM snippet -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>


And I'm trying to run integration tests with failsafe:

<!-- POM snippet -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>run-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>


When I: mvn verify

I see this:

[INFO] --- maven-failsafe-plugin:2.14.1:integration-test (run-tests) @ rest-services-test ---




T E S T S



Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

Spent the last 4 1/2 hours scouring, help appreciated. The only other thing maybe worth mentioning is I have cargo setting up and tearing down a tomcat container. Does anybody see the glaring problem?

D

Answer

You need to rename your test class.

You can find the names the plugin looks for by default in the documentation, as pointed out by @acdcjunior:

By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns:

  • "**/IT*.java" - includes all of its subdirectories and all java filenames that start with "IT".
  • "**/*IT.java" - includes all of its subdirectories and all java filenames that end with "IT".
  • "**/*ITCase.java" - includes all of its subdirectories and all java filenames that end with "ITCase".
Comments