mikeb
mikeb

Reputation: 11287

Maven - run integration and unit tests

I have 2 sets of tests defined in Maven - integration-test and test.

If I run maven test - my tests run

If I run maven integration-test - both run

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.4.3</version>
    <executions>
      <execution>
        <id>default-test</id>
        <configuration>
          <forkMode>always</forkMode>
          <excludes>
            <exclude>**/TC_Integration*</exclude>
          </excludes>
          <includes>
            <include>**/TC_*</include>
          </includes>
        </configuration>
      </execution>
      <execution>
        <id>integration-test</id>
        <phase>integration-test</phase>
        <goals>
          <goal>test</goal>
        </goals>
        <configuration>
          <excludes>
            <exclude>**/TC_Unit*</exclude>
          </excludes>
          <includes>
            <include>**/TC_*</include>
          </includes>
        </configuration>
      </execution>
    </executions>
  </plugin>
  <plugin>

What's the best way to make both run all the time? I mainly want maven install to run both, but it's not.

Upvotes: 0

Views: 84

Answers (1)

Aaron Davis
Aaron Davis

Reputation: 1731

Instead of trying to configure surefire to run both unit and integration tests, configure surefire to run just the unit tests and use the failsafe plugin to run the integration tests.

https://maven.apache.org/surefire/maven-failsafe-plugin/

Upvotes: 2

Related Questions