This document contains the change log for all JUnit 5 releases since 5.4 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.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 a complete list of all closed issues and pull requests for this release, consult the 5.5 M1, 5.5 RC1, 5.5 RC2, and 5.5 GA milestone pages in the JUnit repository on GitHub.
JUnit Platform
New Features and Improvements
-
Configurable test discovery implementation that can be reused by different test engines (see Javadoc of the
org.junit.platform.engine.support.discoverypackage). -
New
isFinal()andisNotFinal()methods inModifierSupport.
Bug Fixes
-
A custom
ClassLoadercreated for additional--class-pathentries passed to theConsoleLauncherwill now be closed after usage to gracefully free file handles.
Deprecations and Breaking Changes
-
The internal
PreconditionViolationExceptionclass in concealed packageorg.junit.platform.commons.utilis now deprecated and has been replaced by an exception class with the same name in exported packageorg.junit.platform.commons.
New Features and Improvements
-
AnnotationSupport.findRepeatableAnnotations()now finds repeatable annotations used as meta-annotations on other repeatable annotations. -
New
AnnotationSupport.findRepeatableAnnotations()variant that accepts ajava.util.Optional<? extends AnnotatedElement>argument. -
An exception thrown by a
TestExecutionListenerno longer causes test execution to abort. Instead, such exceptions will be logged as warnings now. -
New
MethodSource.from()variant that acceptsString, String, Class<?>…as arguments.
JUnit Jupiter
Bug Fixes
-
Execution of dynamic tests registered via a
@TestFactorymethod no longer results in anOutOfMemoryErrorif the executables in the dynamic tests retain references to objects consuming large amounts of memory. Technically speaking, JUnit Jupiter no longer retains references to instances ofDynamicTestafter they have been executed. -
Extensions registered programmatically using
@RegisterExtensionon fields of test classes now work correctly for tests in contained@Nestedtest classes. Previously, such extensions were registered multiple times for each test method in@Nestedclasses.
Deprecations and Breaking Changes
-
Script-based condition APIs and their supporting implementations are deprecated with the intent to remove them in JUnit Jupiter 5.6. Users should instead rely on a combination of other built-in conditions or create and use a custom implementation of
ExecutionConditionto support the same conditions.
New Features and Improvements
-
Support for declarative timeouts using
@Timeoutor configuration parameters (see User Guide for details). -
The
JREenum used with@EnabledOnJreand@DisabledOnJrenow supports Java 14. -
Expected and actual values are now supplied for failed
booleanassertions for enhanced IDE and reporting support — for example, whenassertTrue()orassertFalse()fails. -
New overloaded variants of
Assertions.assertLinesMatch(…)that accept aStringor aSupplier<String>for a custom failure message. -
Failure messages for
Assertions.assertLinesMatch(…)now emit each expected and actual line in a dedicated line. -
New Kotlin-friendly
assertDoesNotThrow(),assertTimeout(), andassertTimeoutPreemptively()assertions have been added as top-level functions in theorg.junit.jupiter.apipackage. -
Parameterized tests now support implicit conversion from a
Stringto the followingjava.timetypes:Duration,Period,MonthDay,ZoneId, andZoneOffset. -
@ValueSourcenow additionally supports literal values of typebooleanfor parameterized tests. -
New
emptyValueattribute in@CsvSourceand@CsvFileSource. -
Display names for test methods generated by the
ReplaceUnderscoresDisplayNameGeneratorno longer include empty parentheses for test methods that do not declare any parameters. -
New
junit.jupiter.displayname.generator.defaultconfiguration parameter to set the defaultDisplayNameGeneratorthat will be used unless@DisplayNameor@DisplayNameGenerationis present. -
New
junit.jupiter.execution.parallel.mode.classes.defaultconfiguration parameter allows to run top-level classes in parallel but their methods sequentially or vice versa (see User Guide for details). -
MethodOrderer.Randomnow generates a default random seed only once and prints it to the log in order to allow reproducible builds. -
Methods ordered with
MethodOrderer.Randomnow execute using theSAME_THREADconcurrency mode instead of theCONCURRENTmode when no custom seed is provided. -
The declared field type for an extension registered via
@RegisterExtensionis no longer required to implement anExtensionAPI. It is now sufficient if the extension implementation can be assigned to the declared field type. This provides extension authors greater flexibility as well as the ability to hide implementation details of the user facing extension API. -
Private fields annotated with
@RegisterExtensionare no longer silently ignored. Instead the corresponding test class or test method will now fail with an exception informing the user of the configuration error. -
New
InvocationInterceptorextension API (see User Guide for details). -
New
LifecycleMethodExecutionExceptionHandlerextension API for handling exceptions thrown during the execution of@BeforeAll,@BeforeEach,@AfterEach, and@AfterAlllifecycle methods (see User Guide for details). -
All methods in the
TestWatcherAPI are now interfacedefaultmethods with empty implementations. -
A custom test source for a
DynamicContainerorDynamicTestmay now be a method URI — for example,method:org.example.MyTestClass#myTestMethod(). -
A new
getOrDefault()convenience method has been added toExtensionContext.Store.
JUnit Vintage
New Features and Improvements
-
junit:junitis now a compile-scoped dependency ofjunit-vintage-engineto allow for easier dependency management in Maven POMs. -
A method that is
publicis now preferred over other methods with the same name in the same test class when creating aMethodSourcefor a JUnit 4Description.
5.4.2
Date of Release: April 7, 2019
Scope: Bug fixes since 5.4.1
For a complete list of all closed issues and pull requests for this release, consult the 5.4.2 milestone page in the JUnit repository on GitHub.
5.4.1
Date of Release: March 17, 2019
Scope: Bug fixes since 5.4.0
For a complete list of all closed issues and pull requests for this release, consult the 5.4.1 milestone page in the JUnit repository on GitHub.
5.4.0
Date of Release: February 7, 2019
Scope:
-
New
junit-jupiterdependency-aggregating artifact for simplified dependency management in build tools -
XML report generating listener
-
Test Kit for testing engines and extensions
-
nulland empty argument sources for@ParameterizedTestmethods -
@TempDirsupport for temporary directories -
Custom display name generator API
-
Support for ordering test methods
-
Support for ordering extensions registered via
@RegisterExtension -
TestWatcherextension API -
API for accessing outer test instances in
ExtensionContext -
JUnit 4
@Ignoremigration support -
Improved diagnostics and error reporting
-
Improved documentation and user experience in the User Guide
-
Discontinuation of the
junit-platform-surefire-provider -
Various minor improvements and bug fixes
For complete details consult the 5.4.0 Release Notes online.