Is there a way to tell surefire to skip tests in a certain package?

maven-2, surefire

Solution

Let me extend Sean's answer. This is what you set in `pom.xml`:

<properties>
  <exclude.tests>nothing-to-exclude</exclude.tests>
</properties>
<profiles>
  <profile>
    <id>fast</id>
    <properties>
      <exclude.tests>**/*Dao*.java</exclude.tests>
    </properties>
  </profile>
</profiles>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <excludes>
     <exclude>${exclude.tests}</exclude>
    </excludes>
  </configuration>
</plugin>

Then in CI you start them like this:

mvn -Pfast test

That's it.

Problem

Something like the following. I would like a way to skip my dao tests in surefire. Trying to avoid overhead of defining Suites. With CI I'd like to have one nightly that runs all tests and another 5 minute poll of SCM that runs only 'fast' tests. ``` mvn -DskipPattern=**.dao.** test ```

Original source