GeezerVison is showing docs.junit.org — JUnit 5 Release Notes
There is a newer version available.
For the latest stable release, please see the new documentation site!
JUnit 5 Release Notes
Stefan Bechtold
Sam Brannen
Johannes Link
Matthias Merdes
Marc Philipp
Juliette de Rancourt
Christian Stein
version 5.13.3
This document contains the change log for all JUnit 5 releases since 5.12 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.13.3
Date of Release: July 4, 2025
Scope: Bug fixes and enhancements since 5.13.2
For a complete list of all closed issues and pull requests for this release, consult the
5.13.3 milestone page in the JUnit
repository on GitHub.
Overall Changes
New Features and Improvements
JUnit Jupiter
Bug Fixes
-
Fix regression that caused top-level and static member classes annotated with @Nested
to no longer be executed because they caused a discovery issue to be reported.
-
Stop reporting discovery issues for composed annotation classes that are meta-annotated
with @Nested.
-
Stop reporting discovery issues for DefaultImpls classes generated by the Kotlin
compiler for interfaces with non-abstract test methods.
-
When a customReason is supplied along with a null value for the default reason to
ConditionEvaluationResult.disabled(String, String), the resulting reason is now
"my custom reason" instead of
"null ==> my custom reason".
New Features and Improvements
-
A blank reason supplied to a ConditionEvaluationResult factory method is now treated
the same as a null reason, resulting in an empty Optional returned from
ConditionEvaluationResult.getReason().
-
The Javadoc for factory methods in ConditionEvaluationResult now explicitly states
that both null and blank values are supported for reason strings and that such
values will result in an empty Optional returned from
ConditionEvaluationResult.getReason().
-
Improve message of discovery issues reported for ineffective @Order annotations.
5.13.2
Date of Release: June 24, 2025
Scope: Bug fixes and enhancements since 5.13.1
For a complete list of all closed issues and pull requests for this release, consult the
5.13.2 milestone page in the JUnit
repository on GitHub.
JUnit Platform
Bug Fixes
-
If Git information is included in the Open Test Reporting XML format (see below), any
credentials that may be configured as part the remote.origin.url setting in Git were
previously written to the originUrl attribute of <git:repository> elements. For
example, when cloning a GitHub repository using a URL like
https://username:[email protected]/organization/repository.git, both username and
password were included in the XML report. Since a report which includes this information
may be shared, published, or archived (for example, on a CI server), this was reported
as a potential security vulnerability (CVE-2025-53103). Any credentials are now replaced
with *** before writing them to the XML report.
Deprecations and Breaking Changes
JUnit Jupiter
Bug Fixes
-
Stop reporting discovery issues for cyclic inner class hierarchies not annotated with
@Nested.
-
Stop reporting discovery issues for abstract inner classes that contain test methods
but are not annotated with @Nested.
-
Stop reporting discovery issues for abstract test methods. Although they will not be
executed, it is a valid pattern to annotate them with @Test for documentation purposes
and override them in subclasses while re-declaring the @Test annotation.
New Features and Improvements
5.13.1
Date of Release: June 7, 2025
Scope: Bug fixes and enhancements since 5.13.0
For a complete list of all closed issues and pull requests for this release, consult the
5.13.1 milestone page in the JUnit
repository on GitHub.
JUnit Jupiter
Bug Fixes
-
The 5.13.0 release introduced a regression regarding the execution order in test classes
containing both test methods and @Nested test classes. When classpath scanning was
used during test discovery — for example, when resolving a package selector for a
@Suite class — test methods in @Nested classes were executed before test methods
in their enclosing class. This undesired change in behavior has now been reverted so
that tests in @Nested test classes are always executed after tests in enclosing test
classes again.
-
Fix support for AnnotationBasedArgumentsProvider implementations that override the
deprecated provideArguments(ExtensionContext, Annotation) method.
5.13.0
Date of Release: May 30, 2025
-
Introduce @ClassTemplate and @ParameterizedClass support in JUnit Jupiter
-
Access to ParameterInfo for JUnit Jupiter extensions
-
New @SentenceFragment annotation for use with IndicativeSentences display name generator
-
Add --redirect-stdout and --redirect-stderr options to ConsoleLauncher
-
Introduce test discovery support in EngineTestKit
-
Reporting of discovery issues for test engines
-
Resource management for launcher sessions and execution requests
-
GraalVM: removal of native-image.properties files from JARs
-
Bug fixes and other minor improvements
Overall Changes
Deprecations and Breaking Changes
-
The JUnit feature in GraalVM Native Build Tools (NBT) has been rewritten to no longer
require JUnit classes to be initialized at build time when running on JDK 22 and later.
Therefore, JUnit’s JARs no longer ship with native-image.properties files that contain
--initialize-at-build-time options (introduced in 5.12.0). Please update to the most
recent version of GraalVM Native Build Tools prior to upgrading to this version of
JUnit. Please refer to the
Upgrade Instructions
in the wiki for details if you’re on NBT 0.10.x or earlier.
JUnit Platform
Bug Fixes
-
Notify LauncherDiscoveryListener implementation registered via LaucherConfig or on
the Launcher of selectorProcessed events.
-
Reintroduce support for JVM shutdown hooks when using the -cp/--classpath option of
the ConsoleLauncher. Prior to this release, the created class loader was closed prior
to JVM shutdown hooks being invoked, which caused hooks to fail with a
ClassNotFoundException when loading classes during shutdown.
-
Fix support of --uid and --select-unique-id options in the console launcher.
New Features and Improvements
-
Introduce a mechanism for TestEngine implementations to report issues encountered
during test discovery. If an engine reports a DiscoveryIssue with a Severity equal
to or higher than a configurable critical severity, its tests will not be executed.
Instead, the engine will be reported as failed during execution with a failure message
listing all critical issues. Non-critical issues will be logged but will not prevent the
engine from executing its tests. The critical severity can be configured via a new
configuration parameter and, currently, defaults to ERROR. Please refer to the
User Guide for details.
If you’re a test engine maintainer, please see the
User Guide for details on how
to start reporting discovery issues.
-
Start reporting discovery issues for problematic @Suite classes:
-
Invalid @Suite class declarations (for example, when private)
-
Invalid @BeforeSuite/@AfterSuite method declarations (for example, when not
static)
-
Cyclic dependencies between @Suite classes
-
Introduce resource management mechanism that allows preparing and sharing state across
executions or test engines via stores that are scoped to a LauncherSession or
ExecutionRequest. The Jupiter API uses these stores as ancestors to the Store
instances accessible via ExtensionContext and provides a new method to access them
directly. Please refer to the User Guide for examples of managing
session-scoped
and
request-scoped
resources.
-
New ConsoleLauncher options --redirect-stdout and --redirect-stderr for
redirecting stdout and stderr output streams to files.
-
Add TestDescriptor.Visitor.composite(List) factory method for creating a composite
visitor that delegates to the given visitors in order.
-
Introduce test discovery support in EngineTestKit to ease testing for discovery
issues produced by a TestEngine. Please refer to the
User Guide for details.
-
Make validation of including EngineFilters more strict to avoid misconfiguration, for
example, due to typos. Prior to this release, an exception was only thrown when none
of a filter’s included IDs matched any engine. Now, an exception is thrown if at least
one included ID across all filters did not match any engine.
JUnit Jupiter
Bug Fixes
-
If the autoCloseArguments attribute in @ParameterizedTest is set to true, all
arguments returned by registered ArgumentsProvider implementations are now closed even
if the test method declares fewer parameters.
-
AutoCloseable arguments returned by an ArgumentsProvider are now closed even if they
are wrapped with Named.
-
AutoCloseable arguments returned by an ArgumentsProvider are now closed even if a
failure happens prior to invoking the parameterized method.
-
Validate all versions specified in @EnabledOnJre and @DisabledOnJre annotations.
New Features and Improvements
-
New @ClassTemplate annotation and ClassTemplateInvocationContextProvider API that
allow declaring a top-level or @Nested test class as a template to be invoked multiple
times. This may be used, for example, to inject different parameters to be used by all
tests in the class template or to set up each invocation of the class template
differently. Please refer to the
User Guide for details.
-
New BeforeClassTemplateInvocationCallback and AfterClassTemplateInvocationCallback
extension callback interfaces allow implementing extensions that are invoked before and
after each invocation of a class template.
-
New @ParameterizedClass support that builds on @ClassTemplate and allows declaring a
top-level or @Nested test class as a parameterized test class to be invoked multiple
times with different arguments. The same @…Source annotations supported with
@ParameterizedTest may be used to provide arguments via constructor or field
injection. Please refer to the
User Guide for details.
-
New @ParameterizedClass-specific
@BeforeParameterizedClassInvocation/@AfterParameterizedClassInvocation lifecycle
methods that are invoked once before/after each invocation of the parameterized class.
-
Provide access to the parameters and resolved arguments of a @ParameterizedTest or
@ParameterizedClass by storing ParameterInfo in the ExtensionContext.Store for
retrieval by other extensions. Please refer to the
Javadoc
for details.
-
New @SentenceFragment annotation which allows one to supply custom text for individual
sentence fragments when using the IndicativeSentences DisplayNameGenerator. See the
updated documentation in the
User Guide for an
example.
-
New TestTemplateInvocationContext.prepareInvocation(ExtensionContext) callback method
which allows extensions to prepare the ExtensionContext before the test template
method is invoked. This may be used, for example, to store entries in the
ExtensionContext.Store to benefit from its cleanup support or for retrieval by other
extensions.
-
Start reporting discovery issues for potentially problematic test classes:
-
Invalid @Test and @TestTemplate method declarations (for example, when return
type is not void)
-
Invalid @TestFactory methods (for example, when return type is invalid)
-
Multiple method-level annotations (for example, @Test and @TestTemplate)
-
Invalid test class and @Nested class declarations (for example, static @Nested
classes)
-
Potentially missing @Nested annotations (for example, non-abstract inner classes
that contain test methods)
-
Invalid lifecycle method declarations (for example, when private)
-
Invalid @Tag syntax
-
Blank @DisplayName declarations
-
Blank @SentenceFragment declarations
-
@BeforeParameterizedClassInvocation and @AfterParameterizedClassInvocation
methods declared in non-parameterized test classes
-
By default, AutoCloseable objects put into ExtensionContext.Store are now treated
like instances of CloseableResource (which has been deprecated) and are closed
automatically when the store is closed at the end of the test lifecycle. It’s possible
to revert to the old behavior
via a configuration parameter. Please also see the
migration note
for third-party extensions wanting to support both JUnit 5.13 and earlier versions.
-
java.util.Locale arguments are now converted according to the IETF BCP 47 language tag
format. See the
User Guide
for details.
-
Avoid reporting potentially misleading validation exception for @ParameterizedClass
test classes and @ParameterizedTest methods as suppressed exception for earlier
failures.
-
Add support for Kotlin Sequence to @MethodSource, @FieldSource, and
@TestFactory.
-
Allow publishing files to an existing directory via TestReporter and
ExtensionContext, for example, when re-running a test class.
5.12.2
Date of Release: April 11, 2025
Scope: Bug fixes and enhancements since 5.12.1
For a complete list of all closed issues and pull requests for this release, consult the
5.12.2 milestone page in the JUnit repository
on GitHub.
5.12.1
Date of Release: March 14, 2025
Scope: Bug fixes and enhancements since 5.12.0
For a complete list of all closed issues and pull requests for this release, consult the
5.12.1 milestone page in the JUnit repository
on GitHub.
JUnit Platform
Deprecations and Breaking Changes
JUnit Jupiter
New Features and Improvements
-
New ExtensionContext.getEnclosingTestClasses() method to help with migration away from
AnnotationSupport.findAnnotation(Class, Class, SearchOption) (deprecated since 1.12.0)
to AnnotationSupport.findAnnotation(Class, Class, List).
5.12.0
Date of Release: February 21, 2025
-
Output file attachments for tests and containers
-
Improvements to the Open Test Reporting XML output
-
Resource lock definition improvements
-
Thread dumps on test timeouts
-
Parameterized test validation improvements
-
Filtering support for auto-registered extensions
-
Kotlin contracts for assertions
-
Configurable Jupiter extension context scope
-
Enhancements to the ConsoleLauncher
-
Better support for GraalVM native image usage
-
Improved discovery support for file-based test engines
-
Customizable classpath scanning
-
Parallel execution support in JUnit Vintage engine
-
Numerous bug fixes and other enhancements
|