Today I hit a case where some of my tests wouldn’t be picked up to run during Maven’s testing phase. The reason for that is the way the Surefire plugin is picking up names to include by default, namely the **/*Test.java, **/Test*.java, **/*TestCase.java name patterns.
If we want to include all the tests adhering to a common naming convention we can use regex to explicitly specify inclusion in the Surefire plugin:
<project> [...] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.11</version> <configuration> <includes> <include>%regex[.*MyNamingConvention*]</include> </includes> </configuration> </plugin> </plugins> </build> [...] </project>