I have created some integration tests in a java project and I would like to run them with maven-failsafe-plugin but when I try to do so by running mvn clean install, the tests are not executed.
Here is my setup:
I have a multimodule maven project. I use junit5 for testing and my unit tests are executed correctly with maven-surefire-plugin. I can see that the integration tests are compiled as well and I can find them in target/test-classes.
Here are distilled contents of my project files:
// /pom.xml
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
...
<build>
<pluginManagement>
<plugins>
<plugin>
...
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
...
In module pom:
// /submodule1/pom.xml
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
My test files have following path /submodule1/src/test/java/com/example/integrations/*IT.java
Here is an example test file:
public class ClientIT {
@Test
public void callRemoteServerTest() {
...
}
When I run mvn clean install I can see the integration tests are not executed:
--- failsafe:3.2.5:integration-test (integration-test) @ submodule1 ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- failsafe:3.2.5:verify (integration-test) @ submodule1 ---
[INFO]
I thought that the files with **/*IT.java path should be executed by default. Why are they not?