Contents

Related

JUnit

Test locations

By default JUnit will look for test following the glob pattern:

  • **/Test*.java
  • **/*Test.java
  • **/*Tests.java
  • **/*TestCase.java

If you want to add different patterns or locations (as well as exclude them), this can be done via de surefire Maven configuration:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M7</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                </includes>
                <excludes>
                    <exclude>**/FooTest.java</exclude>
                    <exclude>**/NotReallyATest.java</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>