This document contains the change log for all JUnit 5 releases since 5.10 GA.

Please refer to the User Guide for comprehensive reference documentation for programmers writing tests, extension authors, and engine authors as well as build tool and IDE vendors.

5.11.0-M1

Date of Release:

Scope:

  • Numerous bug fixes and enhancements regarding field and method search algorithms

  • @FieldSource annotation for use with @ParameterizedTest methods

  • @AutoClose annotation to automatically close field resources in tests

  • ConversionSupport utility for converting from a string to a supported target type

For a complete list of all closed issues and pull requests for this release, consult the 5.11.0-M1 milestone page in the JUnit repository on GitHub.

JUnit Platform

Bug Fixes

  • Field and method search algorithms now adhere to standard Java semantics regarding whether a given field or method is visible or overridden according to the rules of the Java language. See the new Field and Method Search Semantics section of the User Guide for details.

  • ReflectionSupport.findFields(…​) now returns a distinct set of fields.

  • Fixed parsing of recursive jar URIs which allows the JUnit Platform Launcher to be used inside Spring Boot executable jars for Spring Boot 3.2 and later.

  • The junit-platform-suite-engine now includes configuration provided via @ConfigurationParameter when selecting tests by UniqueId.

  • In order to support using @EnabledInNativeImage on test classes, UniqueIdTrackingListener now tracks descendants of skipped test containers.

Deprecations and Breaking Changes

  • As mentioned in the Bug Fixes section above, field and method search algorithms now adhere to standard Java semantics regarding whether a given field or method is visible or overridden according to the rules of the Java language. The changes in the search algorithms may, however, result in breaking changes for some use cases. In light of that, it is possible to revert to the previous "legacy semantics". See the new Field and Method Search Semantics section of the User Guide for details.

New Features and Improvements

  • New ConversionSupport utility in junit-platform-commons which exposes the conversion logic that was previously private to JUnit Jupiter’s @ParameterizedTest infrastructure — for use in third-party extensions and test engines.

  • Error messages for type mismatches in NamespacedHierarchicalStore now include the actual type and value in addition to the required type.

JUnit Jupiter

Bug Fixes

  • Due to changes in the JUnit Platform regarding field and method search algorithms (see Bug Fixes above), numerous bugs have been addressed within JUnit Jupiter, including but not limited to the following.

    • Two @TempDir fields with the same name in a superclass and subclass will now both be injected.

    • Two @Test methods with the same signature in a superclass and subclass will now both be invoked, as long as the @Test method in the subclass does not override the @Test method in the superclass, which can occur if the superclass method is private or if the superclass method is package-private and resides in a different package than the subclass.

      • The same applies to other types of test methods (@TestFactory, @ParameterizedTest, etc.) as well as lifecycle methods (@BeforeAll, @AfterAll, @BeforeEach, and @AfterEach).

  • TempDir suppresses NoSuchFileException when deleting files that may have been deleted by another thread or process.

Deprecations and Breaking Changes

  • Kotlin support now depends on Kotlin API and language version 1.6; whereas, it previously depended on version 1.3.

New Features and Improvements

  • New @FieldSource annotation for use with @ParameterizedTest methods which allows you to source arguments from a local field or an external field referenced by fully qualified field name. This feature is similar to the existing @MethodSource feature. See the User Guide for details.

  • New @AutoClose annotation that can be applied to fields within tests to automatically close the annotated resource after test execution. See the User Guide for details.

  • JAVA_23 has been added to the JRE enum for use with JRE-based execution conditions.

  • Improved documentation for semantics of a disabled test regarding class-level lifecycle methods and callbacks.

JUnit Vintage

Bug Fixes

Deprecations and Breaking Changes

New Features and Improvements

5.10.2

Date of Release: February 4, 2024

Scope: minor bug fixes and changes since 5.10.1.

For a complete list of all closed issues and pull requests for this release, consult the 5.10.2 milestone page in the JUnit repository on GitHub.

JUnit Platform

Bug Fixes

  • The junit-platform-launcher may now be used as a Java module when junit.platform.launcher.interceptors.enabled is set to true.

    • See issue #3561 for details.

Deprecations and Breaking Changes

  • Field predicates are no longer applied eagerly while searching the type hierarchy.

    • This reverts changes made in 5.10.1 that affected findFields(…​) and streamFields(…​) in ReflectionSupport as well as findAnnotatedFields(…​) and findAnnotatedFieldValues(…​) in AnnotationSupport.

    • See issue #3638 for details.

  • Method predicates are no longer applied eagerly while searching the type hierarchy.

    • This reverts changes made in 5.10.1 that affected findMethods(…​) and streamMethods(…​) in ReflectionSupport as well as findAnnotatedMethods(…​) in AnnotationSupport.

    • See issue #3600 for details.

JUnit Jupiter

Bug Fixes

  • JUnit Jupiter once again properly detects when a @Test method is overridden in a subclass.

    • See issue #3600 for details.

Deprecations and Breaking Changes

  • A package-private static field annotated with @TempDir is once again shadowed by a non-static field annotated with @TempDir when the non-static field resides in a different package and has the same name as the static field.

    • This reverts changes made in 5.10.1.

    • See issue #3638 for details.

  • A package-private class-level lifecycle method annotated with @BeforeAll or @AfterAll is once again shadowed by a method-level lifecycle method annotated with @BeforeEach or @AfterEach when the method-level lifecycle method resides in a different package and has the same name as the class-level lifecycle method.

    • This reverts changes made in 5.10.1.

    • See issue #3600 for details.

JUnit Vintage

No changes.

5.10.1

Date of Release: November 5, 2023

Scope: minor bug fixes and improvements since 5.10.0.

For a complete list of all closed issues and pull requests for this release, consult the 5.10.1 milestone page in the JUnit repository on GitHub.

JUnit Platform

Bug Fixes

  • Field predicates are now applied while searching the type hierarchy. This fixes bugs in findFields(…​) and streamFields(…​) in ReflectionSupport as well as findAnnotatedFields(…​) and findAnnotatedFieldValues(…​) in AnnotationSupport.

  • Method predicates are now applied while searching the type hierarchy. This fixes bugs in findMethods(…​) and streamMethods(…​) in ReflectionSupport as well as findAnnotatedMethods(…​) in AnnotationSupport.

JUnit Jupiter

Bug Fixes

  • A package-private static field annotated with @TempDir is no longer shadowed by a non-static field annotated with @TempDir when the non-static field resides in a different package and has the same name as the static field.

  • A package-private class-level lifecycle method annotated with @BeforeAll or @AfterAll is no longer shadowed by a method-level lifecycle method annotated with @BeforeEach or @AfterEach when the method-level lifecycle method resides in a different package and has the same name as the class-level lifecycle method.

  • The ON_SUCCESS cleanup mode of @TempDir now takes into account failures of test methods and nested tests when it’s declared on the class level, e.g. as a static field.

  • The RandomNumberExtension example in the User Guide has been updated to properly support Integer types as well as non-static field injection.

New Features and Improvements

  • Improved Javadoc for Assertions.assertTimeoutPreemptively regarding thread interrupt.

  • Documentation for @Disabled and conditional annotations now explicitly explains that such annotations are not inherited by subclasses.

JUnit Vintage

Bug Fixes

  • Fixed reporting for JUnit 3 test classes that use JUnit 4’s @Ignored annotation.

5.10.0

Date of Release: July 23, 2023

Scope:

  • Promotion of various experimental APIs to stable

  • New LauncherInterceptor SPI

  • New testfeed details mode for ConsoleLauncher

  • New ConsoleLauncher subcommand for test discovery without execution

  • Dry-run mode for test execution

  • New NamespacedHierarchicalStore for use in third-party test engines

  • Stacktrace pruning to hide internal JUnit calls

  • New @SelectMethod support in test @Suite classes.

  • New TempDirFactory SPI for customizing how temporary directories are created

  • Failure threshold for @RepeatedTest

  • New convenience base classes for implementing ArgumentsProvider and ArgumentConverter

  • Custom class loader support for class/method selectors, @MethodSource, @EnabledIf, and @DisabledIf

  • Improved configurability of parallel execution

  • Numerous bug fixes and minor improvements

For complete details consult the 5.10.0 Release Notes online.