I have two test-suites say A.xml and B.xml. Here's an example of one of them.
<!-- URL Details -->
<parameter name="applicationHostname" value="localhost" />
<parameter name="applicationProtocol" value="http" />
<parameter name="applicationPort" value="8080" />
<parameter name="testDelay" value="0" />
<test verbose="2" name="TestSuiteA" annotations="JDK"
preserve-order="true">
<parameter name="testDataSource" value="Data.json" />
<classes>
<class name="package.SuiteConfiguration" />
<class
name="package.functionalTestAppStart.AppStarter" />
</classes>
</test>
Here AppStarter is springboot app which gets triggered.
Here's my corresponding snippet of POM.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>IT</id>
<phase>test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skip>false</skip>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/suites/FT_TEST_SUITE.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Here FT_TEST_SUITE.xml is parent test suite which just triggers the other two test-suites.
<suite-files>
<suite-file path="TESTSUITE_A.xml" />
<suite-file path="TESTSUITE_B.xml" />
</suite-files>
When I build my maven project "mvn clean install", the testsuites gets triggered 3 times. How to solve this problem? Thanks!
I found the solution with little bit of change. In failsafe_version changing version to 2.13 and changing the phase to integration-test did the job. Here's my updated POM.xml snippet.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.13</version>
<executions>
<execution>
<id>IT</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/suites/FT_TEST_SUITE.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Thanks for all your replies!