If you use the surefire-plugin to run tests, you can configure it to skip them based on the naming pattern:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.14</version> <configuration> <includes> <include>%regex[.*[Cat|Dog].*Test.*]</include> </includes> </configuration> </plugin> </plugins> </build> [...] </project>
This, however, requires that the test file names match the required patterns. At work, we use this approach, and our tests end with ..UnitTest or ..IntegrationTest , so that we can easily disable each of them by changing the regular expression in the corresponding build profile.
Check out the Apache documentation for the surefire plugin. You may find something more useful or more suitable for your business.
source share