SYSTEM Cited by 1 source
Maven Failsafe Plugin¶
Maven Failsafe is the Apache Maven test runner designed
for integration tests. It attaches to the
integration-test and verify phases and, unlike
Surefire, does not fail
the build immediately on a failing test — it defers failure
to verify, letting post-test cleanup (shutdown hooks,
post-integration-test goals) run first. This matters when
tests share expensive resources like Docker containers that
need to tear down cleanly.
Default include patterns target IT naming conventions:
**/IT*.java**/*IT.java**/*ITCase.java
In practice, projects override this to use *IntegrationTest
(Zalando ZMS convention) or similar.
Relevance to Testcontainers ingest¶
Zalando ZMS pairs Failsafe with
Surefire: Surefire owns
*Test in the test phase; Failsafe owns *IntegrationTest
in the integration-test phase. A Maven profile
(with-integration-tests) gates Failsafe — mvn test runs
only unit tests, mvn verify -P with-integration-tests runs
both. See patterns/failsafe-integration-test-separation.
The deferred-failure semantics pair naturally with Testcontainers-backed ITs: even if tests fail, Failsafe gives Testcontainers' shutdown hooks a chance to stop containers before the build aborts.
Seen in¶
- sources/2021-02-24-zalando-integration-tests-with-testcontainers —
Zalando ZMS's canonical pom configuration for Failsafe:
<include>**/*IntegrationTest.java</include>inside awith-integration-testsprofile.
Related¶
- systems/maven-surefire-plugin — unit-test complement.
- systems/junit5 — canonical test framework Failsafe invokes.
- systems/testcontainers — the expensive-resource class that motivates Failsafe's deferred-failure semantics.
- patterns/failsafe-integration-test-separation — the two-phase split pattern this plugin implements.