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.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 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.
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.
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 theget(…)
orgetOrComputeIfAbsent(…)
methods; however, if agetOrComputeIfAbsent(…)
invocation results in the computation of a new value, an exception will still be thrown. -
Fixed potential locking issue with
ExclusiveResource
in theHierarchicalTestExecutorService
, which could lead to deadlocks in certain scenarios.
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 a complete list of all closed issues and pull requests for this release, consult the 5.11.0-M1, 5.11.0-M2, 5.11.0-RC1, and 5.11.0 milestone pages 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 byUniqueId
(backported to 5.10.3). -
In order to support using
@EnabledInNativeImage
on test classes,UniqueIdTrackingListener
now tracks descendants of skipped test containers (backported to 5.10.3). -
Attempting to deserialize a
TestIdentifier
no longer causes aNullPointerException
when there is no parent identifier. See issue 3819 (backported to 5.10.3).
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 injunit-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. -
Updated
open-test-reporting
dependency to0.1.0-M2
. -
All Platform implementations of
DiscoverySelector
now have a parseable string representation that can be generated by calling the newDiscoverySelector.toIdentifier()
method andtoString()
on the returnedDiscoverySelectorIdentifier
. This string representation can be used to reconstruct the originalDiscoverySelector
by calling the newDiscoverySelectors.parse()
method. This change will allow build tools and IDEs to provide generic mechanisms for specifying selectors on the command line or in configuration files without having to support each selector type individually.-
The Console Launcher supports specifying selectors via their identifiers using the
--select
option. For example,--select class:foo.Bar
will run all tests in thefoo.Bar
class. -
Similarly, the JUnit Platform Suite engine provides a new
@Select("<identifier>")
annotation.
-
-
The Console Launcher now provides a
--version
option. -
NamespacedHierarchicalStore
now throws anIllegalStateException
for any attempt to modify or query the store after it has been closed. In addition, an attempt to close a store that has already been closed will have no effect.-
See issue 3614 for details.
-
-
Introduce
@ConfigurationParametersResource
for@Suite
classes and--config-resource
option for ConsoleLauncher that allow specifying additional properties files on the classpath as sources of configuration parameters. -
New
rootCause()
condition inTestExecutionResultConditions
that matches if an exception’s root cause matches all supplied conditions, for use with theEngineTestKit
. -
ReflectionSupport
now supports scanning for classpath resources. -
Introduce
@BeforeSuite
and@AfterSuite
lifecycle methods for@Suite
classes.
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 isprivate
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
).
-
-
-
MethodOrderer.Random
andClassOrderer.Random
now use the same default seed that is generated during class initialization (backported to 5.10.3). -
TestInstancePostProcessor
extensions can now be registered via the@ExtendWith
annotation on non-static fields. -
Methods and constructors invoked via
ExecutableInvoker
now use the same extensions as the context they are invoked from and the sameExtensionContext
is passed to registered instances ofParameterResolver
. -
The
org.junit.jupiter.api.extension.support
package is now exported from theorg.junit.jupiter.api
module
Deprecations and Breaking Changes
-
The registration order of extensions was changed to allow non-static fields to be processed earlier. This change may affect extensions that rely on the order of registration.
-
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
andJAVA_24
have been added to theJRE
enum for use with JRE-based execution conditions. -
New Exception Handling documentation in the User Guide.
-
Improved documentation for Assumptions in the User Guide.
-
Improved Javadoc for
assertThrows()
andassertThrowsExactly()
to make it clear that the supplied message is not the expected message of the thrown exception. -
Improved documentation for semantics of a disabled test regarding class-level lifecycle methods and callbacks.
-
@..Source
annotations for parameterized tests can now be used as repeatable annotations. See the User Guide for details. -
New
argumentSet()
factory method for providing a custom name for an entire set of arguments for a@ParameterizedTest
. See the User Guide for details. -
New
assertInstanceOf
methods added for Kotlin following up with similar JavaassertInstanceOf
methods introduced in5.8
version. -
New generators in
DynamicTest
that take aStream
/Iterator
ofNamed<Executable>
along with a convenientNamedExecutable
interface that can simplify writing dynamic tests, in particular in recent versions of Java that support records. -
@TempDir
now suppressesNoSuchFileException
when attempting to delete files that may have been already deleted by another thread or process. -
@TempDir
now fails fast in caseTempDirFactory::createTempDirectory
returnsnull
, a file, or a symbolic link to a file. -
@TempDir
now fails fast in case the annotated target is of typeFile
andTempDirFactory::createTempDirectory
returns aPath
that does not belong to the default file system. -
Allow potentially unlimited characters per column in
@CsvSource
and@CsvFileSource
by specifyingmaxCharsPerColumn = -1
.
5.10.5
Date of Release: October 4, 2024
Scope: Bug fixes and enhancements since 5.10.4
For a complete list of all closed issues and pull requests for this release, consult the 5.10.5 milestone page in the JUnit repository on GitHub.
5.10.4
Date of Release: September 24, 2024
Scope: Bug fixes and enhancements since 5.10.3
For a complete list of all closed issues and pull requests for this release, consult the 5.10.4 milestone page in the JUnit repository on GitHub.
JUnit Platform
5.10.3
Date of Release: June 27, 2024
Scope: Bug fixes and enhancements since 5.10.2
For a complete list of all closed issues and pull requests for this release, consult the 5.10.3 milestone page in the JUnit repository on GitHub.
JUnit Platform
Bug Fixes
-
The
junit-platform-suite-engine
now includes configuration provided via@ConfigurationParameter
when selecting tests byUniqueId
. -
In order to support using
@EnabledInNativeImage
on test classes,UniqueIdTrackingListener
now tracks descendants of skipped test containers. -
Attempting to deserialize a
TestIdentifier
no longer causes aNullPointerException
when there is no parent identifier. See issue 3819.
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 whenjunit.platform.launcher.interceptors.enabled
is set totrue
.-
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(…)
andstreamFields(…)
inReflectionSupport
as well asfindAnnotatedFields(…)
andfindAnnotatedFieldValues(…)
inAnnotationSupport
. -
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(…)
andstreamMethods(…)
inReflectionSupport
as well asfindAnnotatedMethods(…)
inAnnotationSupport
. -
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.
-
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(…)
andstreamFields(…)
inReflectionSupport
as well asfindAnnotatedFields(…)
andfindAnnotatedFieldValues(…)
inAnnotationSupport
.-
See issue 3532 for details.
-
-
Method predicates are now applied while searching the type hierarchy. This fixes bugs in
findMethods(…)
andstreamMethods(…)
inReflectionSupport
as well asfindAnnotatedMethods(…)
inAnnotationSupport
.-
See issue 3498 for details.
-
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.-
See issue 3532 for details.
-
-
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.-
See issue 3498 for details.
-
-
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 supportInteger
types as well as non-static field injection.
5.10.0
Date of Release: July 23, 2023
Scope:
-
Promotion of various experimental APIs to stable
-
New
LauncherInterceptor
SPI -
New
testfeed
details mode forConsoleLauncher
-
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
andArgumentConverter
-
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.