Skip to content
Latchkey

Maven Failsafe Integration Tests Not Running in CI - Bind the Goals

maven-failsafe-plugin runs integration tests (*IT) in the integration-test/verify phases. If its goals are not bound, or the job runs mvn test (which only runs Surefire unit tests), the ITs never execute.

What this error means

Integration tests named *IT are not executed; CI is green having run only unit tests. Or mvn integration-test runs them but their failures do not fail the build because verify was never called.

maven
[INFO] --- maven-surefire-plugin:3.2.5:test ---
[INFO] Tests run: 12   (only unit tests)
# *IT classes never run because the job called 'mvn test', not 'mvn verify',
# and/or failsafe goals were not bound

Common causes

Failsafe goals not bound

Without <executions> binding integration-test and verify, the plugin does nothing during the lifecycle.

Job runs test instead of verify, or wrong naming

mvn test stops before integration-test. Failsafe also only includes *IT/IT* by default, so *Test-named ITs are skipped.

How to fix it

Bind the Failsafe goals and run verify

Declare both goals and have CI call verify so the assert step fails the build on IT failures.

pom.xml
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <version>3.2.5</version>
  <executions>
    <execution>
      <goals><goal>integration-test</goal><goal>verify</goal></goals>
    </execution>
  </executions>
</plugin>

Run the right phase and name ITs correctly

  1. Invoke mvn -B verify (not test) in CI so integration-test and verify run.
  2. Name integration tests *IT or configure includes to match yours.
  3. Confirm the verify goal is present so IT failures actually fail the build.

How to prevent it

  • Bind Failsafe to integration-test/verify, name ITs *IT, and always run mvn verify in CI so integration failures are not silently passed.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →