This document contains the change log for all JUnit 5 releases since 5.7 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.8.0-M1
Date of Release: ❓
Scope: ❓
For a complete list of all closed issues and pull requests for this release, consult the 5.8 M1 milestone page in the JUnit repository on GitHub.
JUnit Platform
Bug Fixes
-
Method
scanForClassesInPackage(String)
inClasspathScanner
now returns a valid list of class names when the package name is equal to the name of a module on the module path.
Deprecations and Breaking Changes
-
For consistency with the rest of the JUnit Platform, the experimental
LauncherDiscoveryListener
is now an interface instead of an abstract class.
New Features and Improvements
-
New
test(Condition<Event>)
andnestedContainer(Class<?>, Condition<Event>)
methods inEventConditions
that allow you to provide conditions for matching against test and nested container events when using theEngineTestKit
. For example,test(displayName("my test"))
can be used to match against a test whose display name ismy test
. -
The
junit-platform-jfr
module now also reports execution events for containers, e.g. test classes. -
The
junit-platform-jfr
module now also reports test discovery events for the launcher and registered test engines. -
Custom
LauncherDiscoveryListener
implementations can now be registered via Java’sServiceLoader
mechanism. -
Documented constant value of
ExclusiveResource.GLOBAL_KEY
. -
Instances of
TestIdentifier
andUniqueId
now retain less memory because they no longer storeString
representations of unique IDs. -
Improvement of
ExclusiveResource
handling, if aNode
has only read locks and no read-write locks, then descendants are not forced intoSAME_THREAD
execution, and can run concurrently. -
Tools that make multiple calls to the
Launcher
API should now create aLauncherSession
instead in order to allow for executing global setup and teardown code exactly once via the newLauncherSessionListener
interface that can be registered via Java’sServiceLoader
mechanism.
JUnit Jupiter
Deprecations and Breaking Changes
-
InvocationInterceptor.interceptDynamicTest(Invocation<Void> , ExtensionContext)
has been deprecated in favor ofInvocationInterceptor.interceptDynamicTest(Invocation<Void> , DynamicTestInvocationContext, ExtensionContext)
that allows to access the dynamic test executable viaDynamicTestInvocationContext.getExecutable()
.
New Features and Improvements
-
Numeric literals used with
@CsvSource
orCsvFileSource
can now be expressed using underscores as in some JVM languages, to improve readability of long numbers like700_000_000
. -
Documented constant values in
Resources
. -
New
assertInstanceOf
methods as a replacement forassertTrue(obj instanceof X)
which provide better error messages comparable to those ofassertThrows
. -
Dynamic tests now require less memory thanks to a number of improvements to internal data structures.
-
Allow rows in
@CsvSource
to start with a number sign (#) -
New
ignoreLeadingAndTrailingWhitespace
attribute to control whether or not to trim whitespaces in@CsvSource
and@CsvFileSource
(set totrue
by default).
5.7.1
Date of Release: ❓
Scope: Bug fixes since 5.7.0
For a complete list of all closed issues and pull requests for this release, consult the 5.7.1 milestone page in the JUnit repository on GitHub.
General bug fixes
-
For compatibility with
JarInputStream
, all JARs now containMETA-INF/
andMETA-INF/MANIFEST.MF
as their first entries again.
JUnit Platform
JUnit Jupiter
Bug Fixes
-
If the
toString()
implementation of an argument passed to a@ParameterizedTest
method returnsnull
, the display name formatter for the parameterized test now treats the name of the corresponding argument as"null"
instead of throwing an exception. This fixes a regression introduced in JUnit Jupiter 5.7.0. -
Creator functions passed to
ExtensionContext.Store.getOrComputeIfAbsent()
are now only called once even if they throw an exception.
New Features and Improvements
-
The user guide now explains Nested Tests in more detail.
-
New utility method in
TestInstancePreDestroyCallback
helps to ensure all test instances are processed when used in conjunction with@Nested
tests. -
JAVA_17
has been added to theJRE
enum for use with JRE-based execution conditions.
5.7.0
Date of Release: September 13, 2020
Scope:
-
Promotion of experimental features in JUnit Platform and Jupiter
-
Java Flight Recorder support
-
TestKit improvements
-
@Isolated
tests -
Configurable default method orderer
-
Custom disabled reasons for all
@Enabled*
/@Disabled*
annotations -
Improvements to
assertTimeoutPreemptively()
-
Improvements to
@CsvFileSource
and@CsvSource
For complete details consult the 5.7.0 Release Notes online.