Fork me on GitHub

What's New in Surefire 3.6.0

Overview

Apache Maven Surefire 3.6.0 introduces a major architectural simplification: all test frameworks now execute through a single unified JUnit Platform provider (surefire-junit-platform). The five legacy providers have been removed, reducing maintenance complexity and enabling a consistent experience across JUnit 5, JUnit 4, and TestNG.

This page summarizes the key changes and provides a migration guide for users upgrading from Surefire 3.5.x.

Unified Provider Architecture

Starting with 3.6.0, one provider runs all tests:

Test Framework Execution Engine Minimum Version
JUnit 5 (Jupiter) Jupiter Engine (native) 5.x
JUnit 4 Vintage Engine 4.12
JUnit 3 tests Vintage Engine (via JUnit 4 compatibility) Requires JUnit 4.12+ dependency
TestNG TestNG JUnit Platform Engine 6.14.3

No explicit provider configuration is needed — Surefire auto-detects which engines are on the classpath and delegates accordingly.

Benefits

  • Single codebase to maintain for listener, reporter, and launcher logic (previously 5 separate implementations)
  • Consistent behavior across all test frameworks for filtering, parallel execution, and reporting
  • Easier contributions — new features only need to be implemented once

Breaking Changes

Removed Providers

The following legacy provider modules have been removed:

  • surefire-junit3
  • surefire-junit4
  • surefire-junit47
  • surefire-testng

Only one provider module remains: surefire-junit-platform (the unified provider).

Minimum Version Requirements

Dependency Minimum Version Previous Minimum
JUnit 4 4.12 3.8.1
TestNG 6.14.3 5.x
  • JUnit 3: No longer supported as a standalone dependency. JUnit 3 test code can still run, but requires a JUnit 4.12+ dependency on the classpath (the Vintage Engine handles the execution).
  • JUnit 4 versions before 4.12 are no longer supported.
  • TestNG versions before 6.14.3 are no longer supported.

Reimplemented Stack Trace Handling

Stack trace handling has been completely reimplemented as part of the provider unification. The previous per-provider implementations (LegacyPojoStackTraceWriter, JUnit4StackTraceWriter) have been replaced by a new StackTraceProvider and DefaultStackTraceWriter that work uniformly across all test frameworks. The new implementation includes configurable frame filtering and truncation.

Migration Guide

JUnit 5/6 Users

No changes needed. Your tests already run on the JUnit Platform natively.

JUnit 4 Users (4.12+)

No changes needed in most cases. Surefire automatically adds the Vintage Engine and routes your tests through the JUnit Platform. Verify your JUnit 4 dependency is version 4.12 or later:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

JUnit 3 Users

Add or update to a JUnit 4.12+ dependency. Your JUnit 3 test code will continue to run unchanged via the Vintage Engine:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

TestNG Users

Ensure your TestNG version is 6.14.3 or later. Surefire will automatically use the TestNG JUnit Platform Engine to execute your tests:

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.10.2</version>
    <scope>test</scope>
</dependency>

TestNG configuration (groups, listeners, suites, etc.) continues to work through Surefire's plugin configuration and is mapped to the JUnit Platform infrastructure.

The suiteXmlFiles configuration for TestNG is no longer supported. You must now use groups or Junit suite support

Staying on Surefire 3.5.x

If you cannot update your test dependencies, you can stay on the 3.5.x line:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.5.5</version>
</plugin>

Transitional: Using a Legacy Provider with 3.6.0

As a transitional measure, you can add a legacy provider from the 3.5.x line as a plugin dependency:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.6.0</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit4</artifactId>
            <version>3.5.5</version>
        </dependency>
    </dependencies>
</plugin>

Note: this backward compatibility may not be maintained in future releases.

Further Reading