A possible solution would be to add a maven profile to the concerned project and configure the maven-surefire-plugin
to exclude these tests from its test goal execution.
An example would be:
<profiles>
<profile>
<id>trasis</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<excludes>
<!-- exclude tests here -->
<exclude>**/TestCircle.java</exclude>
<exclude>**/TestSquare.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Then your trasis build should run
mvn clean install -Ptrasis
Which will:
- activate the profile above
- apply the customized configuration for the Surefire Plugin
- exclude configured tests (patterns) from the test phase
This profile can then be ignored by local builds while still active on Trasis. Once the issue is fixed, it can then be removed completely from the trasis configuration and from the pom file itself.
Alternatively, and especially if you cannot change the concerned pom file, you can exclude tests (and methods) using the test
option and a well crafted regex:
Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
"-Dtest=???Test, !Unstable*, pkg/**/Ci*leTest.java, *Test#test*One+testTwo?????, #fast*+slowTest
"
"-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]
"
mvn clean install -Dtest=*Test,!FromThisClass#excludeThisMethod