This document contains the change log for all JUnit 5 releases since 5.5 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.6.2
Date of Release: April 10, 2020
Scope: Bug fixes since 5.6.1
For a complete list of all closed issues and pull requests for this release, consult the 5.6.2 milestone page in the JUnit repository on GitHub.
JUnit Platform
Bug Fixes
-
ReflectionSupport.findNestedClasses()no longer detects inner class cycles for classes that do not match the suppliedPredicate. For example, JUnit Jupiter no longer throws an exception if an inner class cycle is detected in a nested class hierarchy whose inner classes are not annotated with@Nested.
5.6.1
Date of Release: March 22, 2020
Scope: Bug fixes since 5.6.0
For a complete list of all closed issues and pull requests for this release, consult the 5.6.1 milestone page in the JUnit repository on GitHub.
5.6.0
Date of Release: January 20, 2020
Scope:
-
New
@EnabledForJreRangeand@DisabledForJreRangeexecution conditions -
@Orderallows to specify relative order -
Parameter names are included in default display names of parameterized test invocations
-
Improvements to
@CsvSourceand@CsvFileSource -
New
TestInstancePreDestroyCallbackextension API -
Performance improvements and bug fixes for the Vintage engine
-
Improved error reporting for failures during test discovery and execution
-
Support for using
any()andnone()in tag expressions -
org.junit.platform.consolenow provides ajava.util.spi.ToolProvider -
DiscoverySelectorsfor tests in inherited nested classes -
OSGi metadata
-
Minor bug fixes and improvements
For a complete list of all closed issues and pull requests for this release, consult the 5.6 M1, 5.6 RC1, and 5.6 GA milestone pages in the JUnit repository on GitHub.
Overall Improvements
-
Gradle Module Metadata is now published for all artifacts.
-
OSGi metadata is now published in all binary JARs.
-
Javadoc now contains a module API overview page.
JUnit Platform
Bug Fixes
-
The
EventConditions.nestedContainer()method in the Engine Test Kit now correctly handles events from multiple levels of nested classes. -
Module
org.junit.platform.launchernow readsjava.loggingdue to usage of types in packagejava.util.logging.
Deprecations and Breaking Changes
-
The
Launchernow propagates errors during test discovery by default instead of only logging and thereby potentially hiding them. In order to restore the old, lenient behavior, you can set thejunit.platform.discovery.listener.defaultconfiguration parameter tologging. -
To support the above feature consistently, a new
EngineDiscoveryListenerinterface was introduced.TestEngineimplementations should now notify the listener that can be accessed via theEngineDiscoveryRequest.getDiscoveryListener()method about each processedDiscoverySelector. Test engines that useEngineDiscoveryRequestResolverdo not have to make any changes. -
In the
EngineTestKitAPI, theall(),containers(), andtests()methods inEngineExecutionResultshave been deprecated in favor of the newallEvents(),containerEvents(), andtestEvents()methods, respectively. The deprecated methods will be removed in JUnit Platform 1.7.0.
New Features and Improvements
-
Running all tests with any tags or without any tags at all is now supported by using the special expressions
any()andnone(). -
ReflectionSupport.findNestedClasses(…)now detects cycles within inner class hierarchies. Consult the Javadoc for details. -
New methods in
DiscoverySelectorsto select and execute individual tests in inherited nested classes, via specific selectors (NestedClassSelectorandNestedMethodSelector). -
New
printFailuresTo(PrintWriter, int)method inTestExecutionSummarythat allows one to specify the maximum number of lines to print for exception stack traces. -
TestExecutionSummary.Failureis now serializable. -
ThrowableCollector.toTestExecutionResult()is now public. -
Exceptions thrown by test engines during discovery and execution are now reported to
TestExecutionListeners. -
The
junit-platform-commonsmodule no longer has a dependency on thejava.compilermodule (in terms of the Java Module System). Specifically, a new internal utility has been introduced inPackageUtilsthat implements functionality equivalent tojavax.lang.model.SourceVersion.isName(CharSequence)from thejava.compilermodule. -
Module
org.junit.platform.consolenow provides ajava.util.spi.ToolProviderimplementation that can be acquired byToolProvider.findFirst("junit")when running on Java 9 or above.
JUnit Jupiter
Bug Fixes
-
Method
assertIterableEquals()inAssertionsno longer throws aStackOverflowErrorwhen comparing iterables with components that themselves implementIterable. -
When
@Nestedis used, the temporary directory is now also injected into instance fields of enclosing classes annotated with@TempDir.
Deprecations and Breaking Changes
-
@EnabledIfand@DisabledIfhave been removed from Jupiter’s API. Script-based condition APIs and their supporting implementations were deprecated in JUnit Jupiter 5.5 with the intent to remove them in JUnit Jupiter 5.6. Users must now rely on a combination of other built-in conditions or create and use a custom implementation ofExecutionConditionto evaluate the same conditions. -
The default
@Ordervalue for non-annotated@RegisterExtensionfields and test methods is nowInteger.MAX_VALUE / 2instead ofInteger.MAX_VALUE. If you had previously assigned extension fields or test methods an explicit order greater thanInteger.MAX_VALUE / 2, this may be a breaking change for you.
New Features and Improvements
-
Support for multi-character delimiters in
@CsvSourceand@CsvFileSource. -
Support for custom
nullvalues in@CsvSourceand@CsvFileSource. -
Documented support for comments in CSV files loaded via
@CsvFileSource. -
Auto-detection of enum type from method signature for
@EnumSource. -
Parameter names are now included in the default display name of a
@ParameterizedTestinvocation (if they are present in the bytecode). The{argumentsWithNames}pattern can also be used in custom names. -
New
@EnabledForJreRangeand@DisabledForJreRangeannotations for enabling or disabling test execution over a range of JRE versions. -
@EnabledIfEnvironmentVariable,@DisabledIfEnvironmentVariable,@EnabledIfSystemProperty, and@DisabledIfSystemPropertymay now be used as repeatable annotations. In other words, it is now possible to declare each of those annotations multiple times on a test interface, test class, or test method. -
JAVA_15has been added to theJREenum for use with JRE-based execution conditions. -
The
@TempDirextension now makes an attempt to delete non-writable files by making them writable first. -
The default
@Ordervalue for non-annotated@RegisterExtensionfields and test methods is nowInteger.MAX_VALUE / 2instead ofInteger.MAX_VALUE. This allows@Orderannotated fields and methods to be explicitly ordered after non-annotated fields and methods. For example, this allows before callback extensions to be registered last and after callback extensions to be registered first, relative to other programmatically registered extensions. -
New
junit.jupiter.execution.timeout.modeconfiguration parameter to control whether timeouts are applied to tests. Supported values includeenabled,disabled, anddisabled_on_debug. -
New
TestInstancePreDestroyCallbackinterface that defines the API for extensions that wish to process test instances after they have been used in tests and before they are destroyed. -
New
TypeBasedParameterResolver<T>abstract base class that serves as a generic adapter for theParameterResolverAPI and simplifies the implementation of a custom resolver that supports parameters of a specific type. -
InvocationInterceptorextensions may now explicitlyskip()an intercepted invocation. This allows executing the invocation by other means — for example, in a forked JVM. -
Discovery of
@Nestedtest classes that form a cycle now results in an exception that halts execution of the JUnit Jupiter test engine instead of infinite recursion.
JUnit Vintage
New Features and Improvements
-
To support adoption of the recent JUnit 4.13 release, the Vintage engine now requires the new version in its POM and Gradle Module Metadata. However, if you absolutely have to stay on 4.12, you can safely downgrade the dependency manually because the Vintage engine will remain compatible with 4.12.
-
Performance improvements for projects with a large number of tests.
-
Performance improvements for test classes with a large number of methods.
5.5.2
Date of Release: September 8, 2019
Scope: Bug fixes since 5.5.1
For a complete list of all closed issues and pull requests for this release, consult the 5.5.2 milestone page in the JUnit repository on GitHub.
Overall Improvements
-
Published artifacts have been fixed regarding module descriptors.
-
Binary JAR files contain
module-info.class. -
Source JAR files contain
module-info.java. -
Javadoc JAR files contain neither
module-info.classnormodule-info.java.
-
JUnit Jupiter
Bug Fixes
-
The
JupiterTestEngineno longer crashes without executing any tests if JUnit 4 is on the classpath but Hamcrest is not. Specifically, initialization of theOpenTest4JAndJUnit4AwareThrowableCollectorclass no longer fails if theorg.junit.internal.AssumptionViolatedExceptionclass cannot be loaded from the classpath due to a missing Hamcrest dependency.
5.5.1
Date of Release: July 20, 2019
Scope: Bug fixes since 5.5.0
For a complete list of all closed issues and pull requests for this release, consult the 5.5.1 milestone page in the JUnit repository on GitHub.
5.5.0
Date of Release: June 30, 2019
Scope:
-
Declarative
@Timeoutsupport -
New
InvocationInterceptorextension API -
New
LifecycleMethodExecutionExceptionHandlerextension API -
Deprecation of script-based conditions (
@EnabledIfand@DisabledIf) -
Configurable test discovery implementation for
TestEngineauthors -
Explicit Java module descriptors
-
Various minor improvements and bug fixes
For complete details consult the 5.5.0 Release Notes online.