Skip to content

Support JUnit Platform 6.0.x (unified versioning from JUnit 6) #113

@clara-deadline

Description

@clara-deadline

Problem

JUnit 6.0.0 shipped with unified versioning — all artifacts (Platform, Jupiter, Vintage) now share the same 6.0.x version number. What was previously junit-platform-engine:1.10.x is now junit-platform-engine:6.0.x.

Spring Boot 4.0.5 ships JUnit Platform 6.0.3 by default. Projects on Spring Boot 4 cannot use the pitest-junit5-plugin because the plugin's coverage analysis phase finds 0% coverage and runs 0 tests per mutation.

Reproduction

Environment:

  • JDK 25 (Temurin 25.0.2+10)
  • Gradle 8.14
  • Spring Boot 4.0.5
  • junit-platform-engine:6.0.3 (managed by Spring Boot BOM)
  • gradle-pitest-plugin:1.15.0 (1.19.0 corrupts the test classpath — see below)
  • pitest:1.22.1 (for JDK 25 / ASM 9.8+ support)
  • pitest-junit5-plugin:1.2.1 and 1.2.2 (both tested)

Config (Gradle Kotlin DSL):

pitest {
    pitestVersion.set("1.22.1")
    junit5PluginVersion.set("1.2.2")
    targetClasses.set(setOf("com.example.*"))
    mutationThreshold.set(60)
}

Result:

8:41:22 PIT >> INFO : Sending 362 test classes to minion
>> Line Coverage (for mutated classes only): 0/3298 (0%)
>> Generated 1132 mutations Killed 0 (0%)
>> Mutations with no coverage 1132. Test strength 100%
>> Ran 0 tests (0 tests per mutation)

PIT discovers the test classes (362) and generates mutations (1132), but the coverage analysis phase cannot execute any tests — presumably because the shaded JUnit Platform classes inside the plugin are version 1.x and don't match the 6.x runtime.

Additional observation: gradle-pitest-plugin:1.19.0 causes a separate issue — it corrupts the Gradle test classpath so that even non-Pitest gradle test tasks fail with "Could not complete execution for Gradle Test Executor". Reverting to 1.15.0 restores normal test execution (but the 0-coverage Pitest issue remains).

Expected behavior

The pitest-junit5-plugin should work with JUnit Platform 6.0.x, since JUnit 6 is described as a smooth migration from JUnit 5 with unchanged annotations, extensions, and test discovery API.

Likely fix

Since JUnit 6 is API-compatible with JUnit 5 (unified versioning, not a rewrite), the fix is likely:

  1. Bump the shaded junit-platform-launcher dependency to 6.0.x
  2. Update version compatibility checks that may be gating on 1.x platform versions
  3. Re-shade and release

Impact

This blocks mutation testing for any project on Spring Boot 4+ (which is the current GA release). Spring Boot 4 manages junit-platform:6.0.3 via its BOM, and there's no clean way to downgrade to Platform 1.x without breaking Spring's test infrastructure.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions