I am attempting to configure my Maven project to have unit tests and integration tests. The unit tests are already working fine using the Maven Surefire plugin and are named according to the pattern *Test.java.
After adding the Failsafe plugin, like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
I added an integration test named SomeTestIT.java. However, when I run:
mvn failsafe:integration-test
I get the following:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyApp 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-failsafe-plugin:2.18.1:integration-test (default-cli) @ MyApp ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.368 s
[INFO] Finished at: 2015-03-04T14:43:50-06:00
[INFO] Final Memory: 11M/219M
[INFO] ------------------------------------------------------------------------
My test class (buried a few package levels deep beneath the test hierarchy) looks something like:
package com.example.my.package;
import org.junit.Test;
import org.junit.Assert;
import com.example.my.package.SomeService;
import org.junit.runner.RunWith;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.beans.factory.annotation.Autowired;
@RunWith(SpringJUnit4ClassRunner.class)
public class SomeTestIT
{
@Autowired
private SomeService target;
@Test
public void testTest()
{
Assert.assertTrue(false);
}
@Test
public void basicListTest()
{
Assert.assertNotNull(target);
}
}
Where the tests are stubs to make sure that I have the Maven integration working.
I have ensured that:
- My POM includes a direct, test scoped dependency on JUnit.
- I have tried the plugin configuration both with and without an explicit test runner dependency.
- I have tried the configuration above both with and without an explicit include pattern (on the assumption that my class ought to have been picked up by the defaults).
Nonetheless, the tests never actually run. Is there anything else necessary to get the integration tests running?

mvn integration-test? (you should actually useverifyand configure the plugin like maven.apache.org/surefire/maven-failsafe-plugin/usage.html, sinceintegration-testwill only run the tests, whereasverifywill check the results and break the build when necessary). What's the directory containing the test-sources? - Robert Scholteintegration-test,verifyandfailsafe:integration-testall had the same outcome. The last one one was useful while troubleshooting the issue because it allowed me to only kick off the integration tests. - Michael-Xfor logging with debug level and check the plugin configuration. There are probably other hints as well which explain why the tests are skipped. - Robert Scholte