I have added the following plugin in the pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/IT*.java</include>
</includes>
<testSourceDirectory>${basedir}/src/integration-test/java</testSourceDirectory>
<testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
And I have a test under the directory src\integration-test\java called ITSample.java with @Test annotations.
Maven reports
[DEBUG] (s) skip = false
[DEBUG] (s) skipITs = false
[DEBUG] (s) skipTests = false
[DEBUG] (s) testSourceDirectory = ...\src\integration-test\java
[DEBUG] (s) testClassesDirectory = ...\target\it-classes
[DEBUG] (s) includes = [**/IT*.java]
Which seem as intended, but when I run mvn failsafe:integration-test I get back from maven:
[INFO] No tests to run.
Any ideas if I am missing anything or I should set up something differently?
One more thing I noticed is that when I run mvn integration-test
the failsafe plugin is not executed.
I am using the build-helper-maven-plugin
to move my integration tests to a different folder:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
The failsafe plugin I just include like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With