This document contains the change log for all JUnit 5 releases since 5.8 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.9.3
Date of Release: April 26, 2023
Scope: Bug fixes and enhancements since 5.9.2
For a complete list of all closed issues and pull requests for this release, consult the 5.9.3 milestone page in the JUnit repository on GitHub.
JUnit Jupiter
Bug Fixes
-
Parameter types for local
@MethodSource
factory method names are now validated. For example,@MethodSource("myFactory(example.NonexistentType)")
will now result in an exception stating thatexample.NonexistentType
cannot be resolved to a valid type. -
The syntax for parameter types in local
@MethodSource
factory method names now supports canonical array names — for example, you may now specifyint[]
as in@MethodSource("myFactory(int[])")
instead of the binary name[I
as in@MethodSource("myFactory([I)")
(which was already supported) and@MethodSource("myFactory(java.lang.String[])")
instead of@MethodSource("myFactory([Ljava.lang.String;)")
. -
The search algorithm used to find
@MethodSource
factory methods now applies consistent semantics for local qualified method names and fully-qualified method names for overloaded factory methods. -
The
{displayName}
placeholder for@ParameterizedTest
invocation names is no longer parsed usingjava.text.MessageFormat
. Consequently, any text in the display name of the@ParameterizedTest
method will be included unmodified in the invocation display name. For example, Kotlin method names and custom display names configured via@DisplayName
can now contain apostrophes ('
) as well as text resemblingMessageFormat
elements such as{0}
or{data}
. -
Exceptions thrown for files that cannot be deleted when cleaning up a temporary directory created via
@TempDir
now include the root cause. -
Lifecycle methods are allowed to be declared as
private
again for backwards compatibility; however, usingprivate
visibility for lifecycle methods is strongly discouraged and will be disallowed in a future release.
New Features and Improvements
-
The search algorithm used to find
@MethodSource
factory methods now falls back to lenient search semantics when a factory method cannot be found by qualified name (without a parameter list) and also provides better diagnostics when a unique factory method cannot be found.
5.9.2
Date of Release: January 10, 2023
Scope: Bug fixes and enhancements since 5.9.1
For a complete list of all closed issues and pull requests for this release, consult the 5.9.2 milestone page in the JUnit repository on GitHub.
JUnit Platform
Bug Fixes
-
The Java 7 based constructor for
ForkJoinPool
is no longer accidentally used on Java 9 or higher when invalidParallelExecutionConfiguration
is provided. Instead, an exception is thrown for invalid configuration, thereby preventing invalid configuration from being silently ignored.
New Features and Improvements
-
New
TestPlan.getTestIdentifier(UniqueId)
andTestPlan.getChildren(UniqueId)
methods to avoid parsing unique IDs unnecessarily during test execution. -
Support for limiting the
max-pool-size
for parallel execution via a configuration parameter. -
Suite discovery now ignores cycles encountered in a test suite and logs an informational message at
CONFIG
level instead of throwing an exception.
JUnit Jupiter
Bug Fixes
-
New
@MethodSource
syntax for explicitly selecting an overloaded local factory method without specifying its fully qualified name.
Deprecations and Breaking Changes
-
The
fixed
parallel execution strategy now allows the thread pool to be saturated by default.
New Features and Improvements
-
JAVA_21
has been added to theJRE
enum for use with JRE-based execution conditions. -
New
junit.jupiter.execution.parallel.config.fixed.max-pool-size
configuration parameter to set the maximum pool size. -
New
junit.jupiter.execution.parallel.config.fixed.saturate
configuration parameter to disable pool saturation.
5.9.1
Date of Release: September 20, 2022
Scope:
-
New
@EnabledInNativeImage
and@DisabledInNativeImage
annotations for testing in GraalVM native images. -
Minor bug fixes and enhancements since 5.9.0
For a complete list of all closed issues and pull requests for this release, consult the 5.9.1 milestone page in the JUnit repository on GitHub.
JUnit Jupiter
Bug Fixes
-
Headers provided via the
value
attribute in@CsvSource
for a@ParameterizedTest
are now properly parsed when theuseHeadersInDisplayName
attribute is set totrue
. -
A
@ParameterizedTest
method configured with a@MethodSource
annotation that references a factory method inherited from multiple interfaces no longer fails with an exception stating that multiple factory methods with the same name were found. -
A
@ParameterizedTest
method configured with a@MethodSource
annotation that references a factory method whose name is the same as other non-factory methods in the same class no longer fails with an exception stating that multiple factory methods with the same name were found. -
Assertion failures thrown from methods with applied timeouts using
ThreadMode.SEPARATE
are now properly reported.
5.9.0
Date of Release: July 26, 2022
Scope:
-
XML reports in new Open Test Reporting format
-
Configurable cleanup mode for
@TempDir
-
Configurable thread mode for
@Timeout
-
Conditional execution based on OS architectures
-
New
TestInstancePreConstructCallback
extension API -
Reusable parameter resolution for custom extension methods via
ExecutableInvoker
-
Parameter injection for
@MethodSource
methods -
New
IterationSelector
-
Various improvements to
ConsoleLauncher
For a complete list of all closed issues and pull requests for this release, consult the 5.9 M1, 5.9 RC1, and 5.9 GA milestone pages in the JUnit repository on GitHub.
JUnit Platform
Bug Fixes
-
Fixed handling of global post-discovery filters that apply to
@Suite
classes. -
Since the Turkish language has special characters such as 'ı' and 'İ', the uppercase conversion in
DefaultParallelExecutionConfigurationStrategy#getStrategy
previously caused all tests to finish with exit code -1. This has been fixed by using the root locale instead of the default one. -
Absolute path entries are now supported in JUnit’s Platform Console Launcher on Windows.
-
Attempts to load a
Class
for an invalid class name representing an extremely large multidimensional array now fail within a reasonable amount of time. -
Fix concurrency issue in classpath scanning.
Deprecations and Breaking Changes
-
ConfigurationParameters.size()
has been deprecated in favor of the newkeySet()
method.
New Features and Improvements
-
Support for the Open Test Reporting format which supports all features of the JUnit Platform such as hierarchical test structures, display names, tags, etc. Please refer to the User Guide for instructions on how to enable such reports in your build.
-
ConfigurationParameters
has a newkeySet()
method which allows you to retrieve all configuration parameter keys. -
New
IterationSelector
for selecting a subset of a test’s or container’s iterations. -
ParallelExecutionConfiguration
allows configuring thesaturate
predicate of theForkJoinPool
used for parallel test execution. -
JUnit OSGi bundles now contain
engine
andlauncher
requirements ensuring that at resolution time a fully running set of dependencies is calculated, avoiding the need for these to be manually specified. -
JUnit Platform Standalone Console JAR now also includes the JUnit Platform Suite Engine.
-
New
failIfNoTests
attribute added to@Suite
. This will fail the suite if no tests are discovered. -
The output color for the
ConsoleLauncher
can now be customized. The option--single-color
will apply a built-in monochrome style, while--color-palette
will accept a properties file. See the User Guide for details. -
The default theme for the
ConsoleLauncher
is now determined by the charset reported by the system console on Java 17 and later. -
New
--list-engines
option added to theConsoleLauncher
which displays all registered test engine implementations. -
Configuring included
EngineFilters
that do not match any registeredTestEngine
results in an error to avoid misconfiguration – for example, due to typos. -
New public factory method to instantiate an
ExecutionRequest
. -
Documentation for overriding the JUnit version used in Spring Boot applications. See the User Guide for details.
JUnit Jupiter
Bug Fixes
-
When cleaning up a
@TempDir
, only one retry attempt will be made to delete directories. -
Since the Turkish language has special characters such as 'ı' and 'İ', the uppercase conversion in
DefaultParallelExecutionConfigurationStrategy#getStrategy
previously caused all tests to finish with exit code -1. This has been fixed by using the root locale instead of the default one.
Deprecations and Breaking Changes
-
@TempDir
fields are no longer allowed to be declared asfinal
.-
This improves diagnostics for failures resulting from a user-declared
static final
@TempDir
field by throwing an exception with an informative error message.
-
-
Private lifecycle methods (annotated with
@BeforeAll
,@AfterAll
,@BeforeEach
, or@AfterEach
) now correctly lead to an exception. Although this is a bug fix, it is technically also a breaking change since there might be existing user code withprivate
lifecycle methods which will now start to fail.
New Features and Improvements
-
@TempDir
now includes acleanup
mode attribute for preventing a temporary directory from being deleted after a test. The default cleanup mode can be configured via a configuration parameter. -
Support for FreeBSD and OpenBSD operating systems in
@EnabledOnOs
and@DisabledOnOs
. -
New
MATCH_NONE
mode for@EnumSource
that selects only those enum constants whose names match none of the supplied patterns. -
The
@Order
annotation is now aSTABLE
API. -
New
TestInstancePreConstructCallback
extension API that is called prior to test instance construction – symmetric to the existingTestInstancePreDestroyCallback
extension API. -
Extensions can now leverage registered
ParameterResolver
extensions when invoking methods and constructors via the newExecutableInvoker
API available in theExtensionContext
. -
A subset of the invocations of parameterized or dynamic tests can now be selected via the new
IterationSelector
discovery selector when launching the JUnit Platform. -
JAVA_19
andJAVA_20
have been added to theJRE
enum for use with JRE-based execution conditions. -
@MethodSource
factory methods can now accept arguments resolved by registeredParameterResolver
extensions. -
AssertionFailureBuilder
allows reusing Jupiter’s logic for creating failure messages to assist in writing custom assertion methods. -
Three new
abort
methods have been added to theAssumptions
class. These are analogous to thefail
methods in theAssertions
class, but instead of failing they abort the test or container. -
Support for enabling/disabling tests based on the system’s hardware architecture via new
architectures
attributes in@EnabledOnOs
and@DisabledOnOs
. -
Default
@MethodSource
factory methods can now accept arguments. A default factory method is a method declared in the test class with the same name as the@ParameterizedTest
method that is inferred as the factory method when no explicit factory method is specified in the@MethodSource
annotation. -
Thread mode can be set on
@Timeout
annotation. It allows to configure whether test code is executed in the thread of the calling code or in a separate thread. The three modes are:INFERRED
(default) which resolves the thread mode configured via the propertyjunit.jupiter.execution.timeout.thread.mode.default
,SAME_THREAD
that executes the test code in the same thread as the calling code, andSEPARATE_THREAD
which executes it in a separate thread.
5.8.2
Date of Release: November 28, 2021
Scope:
-
Text blocks in
@CsvSource
are treated like CSV files -
CSV headers in display names for
@CsvSource
and@CsvFileSource
-
Custom quote character support in
@CsvSource
and@CsvFileSource
For a complete list of all closed issues and pull requests for this release, consult the 5.8.2 milestone page in the JUnit repository on GitHub.
JUnit Jupiter
New Features and Improvements
-
Text blocks in
@CsvSource
are now treated like complete CSV files, including support for comments beginning with a#
symbol as well as support for new lines within quoted strings. See the User Guide for details and examples. -
CSV headers can now be used in display names in parameterized tests. See
@CsvSource
and@CsvFileSource
in the User Guide for details and examples. -
The quote character for quoted strings in
@CsvSource
and@CsvFileSource
is now configurable via a newquoteCharacter
attribute in each annotation.
5.8.1
Date of Release: September 22, 2021
Scope:
-
Support for text blocks in
@CsvSource
-
Java 18 support in the
JRE
enum -
Access to the
ExecutionMode
in theExtensionContext
-
Minor bug fixes and enhancements since 5.8.0
For a complete list of all closed issues and pull requests for this release, consult the 5.8.1 milestone page in the JUnit repository on GitHub.
JUnit Platform
Deprecations and Breaking Changes
-
@UseTechnicalNames
has been deprecated in favor of the new@Suite
support which does not require the use of technical names. See the warning in Using JUnit 4 to run the JUnit Platform for details.
JUnit Jupiter
Bug Fixes
-
assertLinesMatch()
inAssertions
no longer fails with aNoSuchElementException
if a limited fast-forward followed by at least one more expected line exceeds the remaining actual lines. -
assertLinesMatch()
inAssertions
now handles fast-forwards with leading and trailing spaces correctly and no longer throws anIndexOutOfBoundsException
.
New Features and Improvements
-
JAVA_18
has been added to theJRE
enum for use with JRE-based execution conditions. -
CSV content in
@CsvSource
can now be supplied as a text block instead of an array of strings. See the User Guide for details and an example. -
The
ExecutionMode
for the current test or container is now accessible via theExtensionContext
.
5.8.0
Date of Release: September 12, 2021
Scope:
-
Declarative test suites via
@Suite
classes -
LauncherSession
and accompanying listener -
New
UniqueIdTrackingListener
-
More fine-grained Java Flight Recorder events
-
Java Flight Recorder support on Java 8 Update 262 or higher
-
Test class ordering
-
@TempDir
can be used to create multiple temporary directories -
Extension registration via
@ExtendWith
on fields and parameters -
Auto-close support for arguments in
@ParameterizedTest
methods -
Memory and performance optimizations
-
Numerous bug fixes and minor improvements
For complete details consult the 5.8.0 Release Notes online.