Question

I'm wondering if there is a way to specify in Maven which collection of JUnit tests run based on package names. An 'exclude' would be ideal, since I have fewer that I need not run than I have those that need to run.

Was it helpful?

Solution

Yes you can configure surefire plugin to include certain tests only

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <includes>
            <include>com/abc/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>

http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top