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.
Date of Release: ❓
For a complete list of all closed issues and pull requests for this release, consult the 5.8 M2 milestone page in the JUnit repository on GitHub.
Date of Release: February 11, 2021
Declarative test suites
Test class ordering
LauncherSessionand accompanying listener
More fine-grained JFR events
Memory and performance optimizations
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.
For consistency with the rest of the JUnit Platform, the experimental
LauncherDiscoveryListeneris now an interface instead of an abstract class.
nestedContainer(Class<?>, Condition<Event>)methods in
EventConditionsthat allow you to provide conditions for matching against test and nested container events when using the
EngineTestKit. For example,
test(displayName("my test"))can be used to match against a test whose display name is
junit-platform-jfrmodule now reports execution events for containers — for example, test classes.
junit-platform-jfrmodule now reports test discovery events for the launcher and registered test engines.
LauncherDiscoveryListenerimplementations can now be registered via Java’s
Documented constant value of
UniqueIdnow retain less memory because they no longer store
Stringrepresentations of unique IDs.
ExclusiveResourcehandling: if a
Nodehas only read locks and no read-write locks, then descendants are not forced into
SAME_THREADexecution and can run concurrently.
Tools that make multiple calls to the
LauncherAPI should now create a
LauncherSessionin order to allow for executing global setup and teardown code exactly once via the new
LauncherSessionListenerinterface that can be registered via Java’s
junit-platform-suite-engineto execute declarative test suites using the JUnit Platform Launcher.
Additional selectors in the suite API in the
InvocationInterceptor.interceptDynamicTest(Invocation<Void>, ExtensionContext)has been deprecated in favor of
InvocationInterceptor.interceptDynamicTest(Invocation<Void>, DynamicTestInvocationContext, ExtensionContext)that provides access to the dynamic test executable via
Top-level test classes can now be ordered by passing the fully-qualified name of a class implementing
ClassOrdereras the value of the new
assertInstanceOf()methods which produce better error messages comparable to those produced by
assertThrows. These new methods serve as a replacement for
assertTrue(obj instanceof X).
assertNull()failure messages now include the actual object’s type if the
toString()implementation for the actual object returns
"null". This avoids the generation of confusing failure messages such as
expected <null> but was <null>.
Numeric literals used with
CsvFileSourcecan now be expressed using underscores as in some JVM languages, to improve readability of long numbers like
CSV rows provided via
@CsvSourcemay now start with a number sign (
trueby default) to control whether or not to trim whitespace.
Dynamic tests now require less memory thanks to a number of improvements to internal data structures.
Documented constant values in
In parameterized tests with
@ArgumentSource, arguments can now have optional names (supplied via the new
NamedAPI). When the argument is included in the display name of an iteration, this name will be used instead of the value.
DynamicTests.stream()can now consume
Namedinput and will use each name-value pair as the display name and value for each generated dynamic test (see User Guide for details).
Date of Release: February 4, 2021
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.
For compatibility with
JarInputStream, all JARs now contain
META-INF/MANIFEST.MFas their first entries again.
"null"if the invocation of
toString()on the supplied object returns
null. Although this is an internal utility, the effect of this change may be witnessed by end users and test engine or extension authors.
ClasspathScannernow returns a valid list of class names when the package name is equal to the name of a module on the module path.
The legacy XML report now always includes container-level failures (e.g. from
@BeforeAllJupiter lifecycle methods).
toString()implementation of an argument passed to a
null, 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.
The user guide now explains Nested Tests in more detail.
New utility method in
TestInstancePreDestroyCallbackhelps to ensure all test instances are processed when used in conjunction with
JAVA_17has been added to the
JREenum for use with JRE-based execution conditions.
Date of Release: September 13, 2020
Promotion of experimental features in JUnit Platform and Jupiter
Java Flight Recorder support
Configurable default method orderer
Custom disabled reasons for all
For complete details consult the 5.7.0 Release Notes online.