I am working on a maven based project. Project has multiple modules. Here is the project structure
-- Project
--Module1 -- pom.xml --Module2 -- pom.xml --Module3-war -- pom.xml --parent module --pom.xml
Parent module packaging type is "pom" and all the modules are defined in this.
I added the failsafe-pligin in parent module pom as shown below
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Now when I am running the "mvn verify" command, failsafe plugin is not getting executed. My Integration test name "TestServiceIT.java" is in module1 in the structure.
When I added the same "failsafe" plugin in my war module then I see that failsafe plugin get executed after creating the WAR but it could not find the test class. See below
[INFO] Started Jetty Server
[INFO]
[INFO] --- maven-failsafe-plugin:2.15:integration-test (integration-test) @ service-integration-test
---
[INFO] No tests to run.
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform d
endent!
[INFO]
[INFO] --- jetty-maven-plugin:8.1.11.v20130520:stop (stop-jetty) @ service-integration-test ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.15:verify (verify) @ service-integration-test ---
[INFO] No tests to run.
So, my questions are
- When failsafe plugin is defined in main pom.xml then why it's not getting executed?
- Why it's not able to find testcases defined in another module?
- What is the best practice for writing the integration test in multi module maven project?