Fork me on GitHub

Selecting Providers

Unified Provider in Surefire 3.6.0+

Since version 3.6.0, Surefire uses a single provider surefire-junit-platform to run all tests:

  • JUnit 5 tests are executed via the Jupiter Engine
  • JUnit 4 tests (4.12 or later) are executed via the Vintage Engine
  • TestNG tests (6.14.3 or later) are executed via the TestNG JUnit Platform Engine

This unified approach simplifies configuration and provides consistent behavior across all test frameworks. In most cases, no explicit provider configuration is needed - Surefire automatically detects and configures the appropriate engines based on your project's test dependencies.

Legacy Provider Selection (Surefire before 3.6.0)

In earlier versions of Surefire, there were multiple providers: surefire-junit3, surefire-junit4, surefire-junit47, surefire-junit-platform and surefire-testng.

Surefire would automatically select which test-framework provider to use based on the version of TestNG/JUnit present in your project's classpath.

Manual Engine Configuration

While explicit provider configuration is rarely needed in Surefire 3.6.0+, you can still add specific JUnit Platform engines as plugin dependencies if needed:

<plugins>
  [...]
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.6.0-SNAPSHOT</version>
    <dependencies>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.9.1</version>
      </dependency>
    </dependencies>
  </plugin>
  [...]
</plugins>

Please note that forcing an engine still requires that the test framework is properly set up on your project classpath.