Currently my integration tests only run when I run mvn install
. I would like to have them run when I do mvn test
.
My <pluginManagement>
section contains:
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...
</pluginManagement>
How can I make the integration tests run when I give only the goal test
?
Actually there is special phases for running integration tests:
They run sequentially, so if you call
mvn integration-test
and it fails, post-integration-test phase won't be invoked.
But if you want to call it within the "test" phase, just move the tests to the appropriate phase:
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>