2

Could not understand this is happening. When I run,

mvn failsafe:integration-test

it fires my integration tests (test ending with ***IT.java) as first. Then, when I execute immediately the same command, it says "No tests to run".

Any help of information would be appreciated. Below is my pom.

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-failsafe-plugin</artifactId>
     <version>2.19.1</version>
     <executions>
       <execution>
         <id>integration-test</id>
         <goals>
            <goal>integration-test</goal>
         </goals>
       </execution>
      <execution>
        <id>verify</id>
         <goals>
            <goal>verify</goal>
         </goals>
      </execution>
    </executions>
</plugin>
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
Vis
  • 43
  • 2
  • 9

2 Answers2

1

If you configure your failsafe plugin as described in http://maven.apache.org/surefire/maven-failsafe-plugin/usage.html:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.19.1</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

then mvn clean verify should do the trick (http://maven.apache.org/surefire/maven-failsafe-plugin/).

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
0

According to the docs you should use

mvn verify

because " when running integration tests, you should invoke Maven with the (shorter to type too) mvn verify rather than trying to invoke the integration-test phase directly, as otherwise the post-integration-test phase will not be executed."

Note that if you have errors in your unittests (the test phase) the build will stop there and the integration tests will not be run (check the Maven Build Lifecycle for what is run when.

tom
  • 1,455
  • 1
  • 8
  • 13