This document contains the change log for all JUnit 5 releases since 5.11 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.12.0-M1

Date of Release:

Scope:

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

Overall Improvements

New Features and Improvements

  • All affected JAR files now include native-image.properties files that contain the --initialize-at-build-time option to avoid breakages in GraalVM projects when updating to newer versions of JUnit.

JUnit Platform

Bug Fixes

Deprecations and Breaking Changes

New Features and Improvements

  • New addResourceContainerSelectorResolver() in EngineDiscoveryRequestResolver.Builder to support the discovery of class path resource based tests, analogous to the addClassContainerSelectorResolver().

  • Introduce ReflectionSupport.makeAccessible(Field) for third-party use rather than calling the internal ReflectionUtils.makeAccessible(Field) method directly.

  • Support both the primitive type void and the wrapper type Void in the internal ReflectionUtils to allow String to Class conversion in parameterized tests.

  • Add support for passing line and column number to ConsoleLauncher via --select-file and --select-resource.

  • ConsoleLauncher now accepts multiple values for all --select options.

  • Add --select-unique-id support to ConsoleLauncher.

  • Add getOutputDirectoryProvider() method to EngineDiscoveryRequest and TestPlan to allow test engines to publish/attach files to containers and tests by calling EngineExecutionListener.fileEntryPublished(…​). Registered TestExecutionListeners can then access these files by overriding the fileEntryPublished(…​) method.

  • The following improvements have been made to the Open Test Reporting XML output:

    • Information about the Git repository, the current branch, the commit hash, and the current worktree status are now included in the XML report, if applicable.

    • A section containing JUnit-specific metadata about each test/container to the HTML report is now written by open-test-reporting when added to the classpath/module path

    • Information about published files is now included as attachments.

    • If output capturing is enabled, the captured output written to System.out and System.err is now included in the XML report.

  • Output written to System.out and System.err from non-test threads is now attributed to the most recent test or container that was started or has written output.

  • Introduced contracts for Kotlin-specific assertion methods.

  • New public interface ClasspathScanner allowing third parties to provide a custom implementation for scanning the classpath for classes and resources.

JUnit Jupiter

Bug Fixes

Deprecations and Breaking Changes

  • When injecting TestInfo into test class constructors it now contains data of the test method the test class instance is being created for unless the test instance lifecycle is set to PER_CLASS (in which case it continues to contain the data of the test class). If you require the TestInfo of the test class, you can implement a class-level lifecycle method (e.g., @BeforeAll) and inject TestInfo into that method.

  • When injecting TestReporter into test class constructors the published report entries are now associated with the test method rather than the test class unless the test instance lifecycle is set to PER_CLASS (in which case they will continue to be associated with the test class). If you want to publish report entries for the test class, you can implement a class-level lifecycle method (e.g., @BeforeAll) and inject TestReporter into that method.

New Features and Improvements

  • New --exclude-methodname and --include-methodname options added to the ConsoleLauncher to include or exclude methods based on fully qualified method names without parameters. For example, --exclude-methodname=^org\.example\..+#methodname will exclude all methods called methodName under package org.example.

  • In a @ParameterizedTest method, a null value can now be supplied for Java Date/Time types such as LocalDate if the new nullable attribute in @JavaTimeConversionPattern is set to true.

  • ArgumentsProvider (declared via @ArgumentsSource), ArgumentConverter (declared via @ConvertWith), and ArgumentsAggregator (declared via @AggregateWith) implementations can now use constructor injection from registered ParameterResolver extensions.

  • Extensions based on TestTemplateInvocationContextProvider can now allow returning zero invocation contexts by overriding the new mayReturnZeroTestTemplateInvocationContexts method.

  • The new @ParameterizedTest(allowZeroInvocations = true) attribute allows to specify that the absence of invocations is expected in some cases and should not cause a test failure.

  • Allow determining "shared resources" at runtime via the new @ResourceLock#providers attribute that accepts implementations of ResourceLocksProvider.

  • Allow declaring "shared resources" for direct child nodes via the new @ResourceLock(target = CHILDREN) attribute. This may improve parallelization when a test class declares a READ lock, but only a few methods hold a READ_WRITE lock.

  • Extensions that implement TestInstancePreConstructCallback, TestInstanceFactory, TestInstancePostProcessor, ParameterResolver, or InvocationInterceptor may override the getTestInstantiationExtensionContextScope() method to enable receiving a test-scoped ExtensionContext in Extension methods called during test class instantiation. This behavior will become the default in future versions of JUnit.

  • @TempDir is now supported on test class constructors.

  • Parameterized tests now support argument count validation. If the junit.jupiter.params.argumentCountValidation=strict configuration parameter or the @ParameterizedTest(argumentCountValidation = STRICT) attribute is set, any mismatch between the declared number of arguments and the number of arguments provided by the arguments source will result in an error. By default, it’s still only an error if there are fewer arguments provided than declared.

  • The new PreInterruptCallback extension point defines the API for Extensions that wish to be called prior to invocations of Thread#interrupt() by the @Timeout extension.

  • When enabled via the junit.jupiter.execution.timeout.threaddump.enabled configuration parameter, an implementation of PreInterruptCallback is registered that writes a thread dump to System.out prior to interrupting a test thread due to a timeout.

  • TestReporter now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format.

JUnit Vintage

Bug Fixes

Deprecations and Breaking Changes

New Features and Improvements

5.11.4

Date of Release: December 16, 2024

Scope: Bug fixes and enhancements since 5.11.3

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

JUnit Platform

Bug Fixes

  • Escape whitespace characters (such as line breaks) in XML attribute values (such as exception messages) in the legacy XML report generated by the Console Launcher. This change ensures the resulting XML files can be processed by downstream tools while preserving whitespace characters.

  • Enable auto-flushing of output in the ConsoleLauncher to fix issues with buffering, in particular when using the --details=testfeed option.

JUnit Jupiter

New Features and Improvements

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

JUnit Vintage

No changes.

5.11.3

Date of Release: October 21, 2024

Scope: Bug fixes and enhancements since 5.11.2

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

JUnit Platform

Bug Fixes

  • Fixed a regression in method search algorithms introduced in 5.11.0 when classes reside in the default package and using a Java 8 runtime.

JUnit Jupiter

Bug Fixes

  • Extensions can once again be registered via multiple @ExtendWith meta-annotations on the same composed annotation on a field within a test class.

  • @ExtendWith annotations can now also be repeated when used directly on fields and parameters.

  • All @…​Source annotations of parameterized tests can now also be repeated when used as meta annotations.

JUnit Vintage

No changes.

5.11.2

Date of Release: October 4, 2024

Scope: Bug fixes and enhancements since 5.11.1

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

JUnit Platform

Bug Fixes

  • Fix regression in parallel execution that was introduced in 5.11.1 regarding global read-write locks. When such a lock was declared on descendants of top-level nodes in the test tree, such as Cucumber scenarios, test execution failed.

JUnit Jupiter

No changes.

JUnit Vintage

No changes.

5.11.1

Date of Release: September 25, 2024

Scope: Bug fixes and enhancements since 5.11.0

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

JUnit Platform

Bug Fixes

  • Fix support for disabling ANSI colors on the console when the NO_COLOR environment variable is available.

  • NamespacedHierarchicalStore no longer throws an exception after it has been closed if the store is queried via one of the get(…​) or getOrComputeIfAbsent(…​) methods; however, if a getOrComputeIfAbsent(…​) invocation results in the computation of a new value, an exception will still be thrown.

  • Fixed potential locking issue with ExclusiveResource in the HierarchicalTestExecutorService, which could lead to deadlocks in certain scenarios.

New Features and Improvements

  • Improve parallelism and reduce number of blocked threads used by HierarchicalTestEngine implementations when parallel execution is enabled and the global read-write lock is used.

JUnit Jupiter

Bug Fixes

  • TestWatcher callback methods can once again access data in the ExtensionContext.Store.

New Features and Improvements

  • Improve parallelism and reduce number of blocked threads in the presence of @Isolated tests when parallel execution is enabled

JUnit Vintage

No changes.

5.11.0

Date of Release: August 14, 2024

Scope:

  • @FieldSource annotation for use with @ParameterizedTest methods

  • Repeatable @..Source annotations for parameterized tests

  • Enhancements for authoring dynamic and parameterized tests

  • @AutoClose annotation to automatically close field resources in tests

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

  • Extensible syntax for specifying discovery selectors

  • @BeforeSuite and @AfterSuite annotations

  • Classpath resource scanning support for engines

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

For complete details consult the 5.11.0 Release Notes online.