Date of Release: September 30, 2016
Scope: Third milestone release of JUnit 5 with a focus on JUnit 4 interoperability, additional discovery selectors, and documentation.
The following is a list of global changes. For details regarding changes specific to the Platform, Jupiter, and Vintage, consult the dedicated subsections below. For a complete list of all closed issues and pull requests for this release, consult the 5.0 M3 milestone page in the JUnit repository on GitHub.
-
❓❓❓
-
ColoredPrintingTestListener
, which is used by theConsoleLauncher
, now outputs the actual exception type and its stack trace when printing an exception message. -
Test classes in the default package are now picked up via classpath scanning when scanning classpath roots — for example, in conjunction with the JUnit Platform Gradle plugin when no explicit packages have been selected.
-
ClasspathSelector
has been renamed toClasspathRootSelector
to avoid confusion withClasspathResourceSelector
. -
PackageSelector
andDiscoverySelectors.selectPackage()
have been renamed toJavaPackageSelector
andDiscoverySelectors.selectJavaPackage()
to align withJavaPackageSource
. -
ClassSelector
andDiscoverySelectors.selectClass()
have been renamed toJavaClassSelector
andDiscoverySelectors.selectJavaClass()
to align withJavaClassSource
. -
MethodSelector
andDiscoverySelectors.selectMethod()
have been renamed toJavaMethodSelector
andDiscoverySelectors.selectJavaMethod()
to align withJavaMethodSource
. -
The
-p
command-line option for configuring additional classpath entries for theConsoleLauncher
has been renamed to-cp
in order to align with the option names for the standardjava
executable. In addition, a new--class-path
alias has been introduced, while the existing--classpath
command-line option remains unchanged.
-
New
selectUri(*)
methods inDiscoverySelectors
for selecting URIs. ATestEngine
can retrieve such values by querying registered instances ofUriSelector
. -
New
selectFile()
andselectDirectory(
) methods in `DiscoverySelectors
for selecting files and directories in the file system. ATestEngine
can retrieve such values by querying registered instances ofFileSelector
andDirectorySelector
. -
New
selectClasspathResource(String)
method inDiscoverySelectors
for selecting classpath resources such as XML or JSON files by name, where the name is a/
-separated path name for the resource within the current classpath. ATestEngine
can retrieve such values by querying registered instances ofClasspathResourceSelector
. -
The
selectMethod(String)
method inDiscoverySelectors
now supports selection of a fully qualified method name for a method that accepts parameters — for example,"org.example.TestClass#testMethod(org.junit.jupiter.api.TestInfo)"
. -
The
TestExecutionSummary
used by theConsoleLauncher
and the JUnit Platform Gradle plugin now includes statistics for all container events in addition to test events.
-
The
JupiterTestEngine
now supports selection of test methods via their unique ID for methods that accept arrays or primitive types as parameters.
-
Support for lazy and preemptive timeouts with lambda expressions in
Assertions
. See examples inAssertionsDemo
and consult the{Assertions}
Javadoc for further details. -
New variants of
Assertions.assertAll()
that accept streams of executables (i.e.,Stream<Executable>
).