Skip to content
Latchkey

Maven Failsafe "There are test failures" (integration) in CI

maven-failsafe-plugin ran the integration tests (*IT) during integration-test and the verify phase reported failures. Unlike Surefire, Failsafe lets the build continue post-integration so resources get torn down, then fails at verify.

What this error means

mvn verify ends with "Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:...:verify ... There are test failures." and a summary of failing *IT classes.

mvn output
[INFO] Results:
[ERROR] Failures:
[ERROR]   OrderFlowIT.placesOrder:88 expected:<200> but was:<500>
[ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 0
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-failsafe-plugin:3.2.5:verify (default) on project app:
There are test failures. -> [Help 1]

Common causes

A real integration test failure

An *IT test asserted something the application or its dependencies did not satisfy in the CI environment.

Missing services or environment in CI

Integration tests need a database, container, or network resource that is present locally but not provisioned in the runner.

How to fix it

Read the failsafe reports

  1. Open target/failsafe-reports/*.txt for the failing *IT.
  2. Fix the code or provision the missing dependency (DB, service container).
  3. Re-run mvn verify to confirm green.
Terminal
mvn -B verify
cat target/failsafe-reports/*.txt

Provision integration dependencies in CI

Start the services the IT suite needs as job services so the runner matches local conditions.

.github/workflows/ci.yml
services:
  postgres:
    image: postgres:16
    env: { POSTGRES_PASSWORD: test }
    ports: ['5432:5432']

How to prevent it

  • Provision required services for integration tests in CI.
  • Keep IT suites hermetic and deterministic.
  • Publish failsafe reports as artifacts for triage.

Related guides

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