Skip to content

SYSTEM

Maven Surefire Plugin

Maven Surefire is Apache Maven's default test runner. It attaches to the test phase of Maven's default lifecycle and executes test classes by naming convention:

  • **/Test*.java
  • **/*Test.java
  • **/*Tests.java
  • **/*TestCase.java

Designed for unit tests — it fails the build immediately on test failure (no post-test hooks), which is the desired semantics for fast-feedback unit suites. Supports JUnit 3/4/5, TestNG, and custom providers via pluggable API.

Relevance to Testcontainers ingest

In the Zalando ZMS stack, Surefire runs the fast, hermetic unit tests in the test phase — the only tests mvn test executes. Slower integration tests get pushed to Failsafe in the integration-test phase, gated by a profile. See patterns/failsafe-integration-test-separation.

The naming-convention split — FooTest for Surefire, FooIntegrationTest for Failsafe — is the mechanical enforcement of which suite a test belongs to.

Seen in

  • — Zalando ZMS's Maven configuration uses Surefire for unit tests in the default test phase, Failsafe for ITs behind the with-integration-tests profile.
Last updated · 542 distilled / 1,571 read