Why doesn't mvn verify run my integration tests?

I have a multi-module project, and I have the fault tolerance defined in the root pump, for example:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.19</version> <configuration> <includes> <include>**/*IntegrationTest.java</include> <include>**/*JourneyTest.java</include> <include>**/*CucumberFeatureTest.java</include> </includes> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19</version> <configuration> <excludes> <exclude>**/*IntegrationTest.java</exclude> <exclude>**/*JourneyTest.java</exclude> <exclude>**/*CucumberFeatureTest.java</exclude> </excludes> </configuration> </plugin> 

Failsafe is not defined anywhere else in my other references. If I run mvn verify , it skips integration tests (it runs unit tests). But if I run mvn test-compile failsafe:integration-test , it runs integration tests.

I suggest that fault tolerance should be implemented in both of these situations. So why doesn't it start when I type mvn verify ?

UPDATE Just noticed that it was wrapped around these tags:

 <build> <pluginManagement> <!-- oops --> <plugins> <plugin> 

It seems to me that this explains the reason, but I'm not sure why unit tests still work, as you would expect with mvn verify and mvn test . Why does surefire work differently from failover in this regard?

+6
source share
2 answers

You need to link the integrity check target without reliable integration with the maven check phase.

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.19</version> <configuration> <includes> <include>**/*IntegrationTest.java</include> <include>**/*JourneyTest.java</include> <include>**/*CucumberFeatureTest.java</include> </includes> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> 
+5
source
 To activate plugin for IntegrationTest, add declaration maven-surefire-plugin at plugins/plugin: <plugins> ... ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> </plugin> </plugins> </build> 
0
source

All Articles