I have a submodule that run integration tests for the whole project, which have several modules. This is the integration tests submodule pom:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sample.server</groupId>
<artifactId>jacoco-test</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.sample.server.modules</groupId>
<artifactId>integration_test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>integration_test</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
</dependency>
<dependency>
<groupId>com.sample.server.modules</groupId>
<artifactId>api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/testng/api.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</execution>
</executions>
</plugin>
</project>
When I execute mvn install or verify then all the standalone tests run and after that the xml suite run too.
I only want to run the suite file, I need to do it this way because some test fails outside of the suite. I tried with the exclude option but failsafe is ignoring that option.
How can I do that?
Change the pom.xml to
<configuration>
<excludes>
<exclude>**/TestCircle.java</exclude>
<exclude>**/TestSquare.java</exclude>
</excludes>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/testng/api.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
where the exclusions are the tests you don't want to run.