From 29f4f70eeb3d6b3e5e2068e3084ef15d0f88ea0c Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 30 Jun 2017 17:53:04 +0200 Subject: [PATCH] Document @TestInstance lifecycle support in the M5 Release Notes Issue: #419 --- .../docs/asciidoc/release-notes-5.0.0-M5.adoc | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes-5.0.0-M5.adoc b/documentation/src/docs/asciidoc/release-notes-5.0.0-M5.adoc index b02cc4d025b6..7255d2f3cb66 100644 --- a/documentation/src/docs/asciidoc/release-notes-5.0.0-M5.adoc +++ b/documentation/src/docs/asciidoc/release-notes-5.0.0-M5.adoc @@ -3,8 +3,8 @@ *Date of Release:* ❓ -*Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers and minor -API changes. +*Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers, test +instance lifecycle management, and minor API changes. WARNING: This is a milestone release and contains breaking changes. Please refer to the <> above to use this version in a version of @@ -38,6 +38,7 @@ is placed on the Java 9 module path. | `junit-vintage-engine-.jar` | `org.junit.vintage.engine` |=== + [[release-notes-5.0.0-m5-junit-platform]] ==== JUnit Platform @@ -69,7 +70,7 @@ is placed on the Java 9 module path. - `junit-platform-commons`: `ReflectionUtils.findAllClassesInClasspathRoot(Path, Predicate, Predicate)` * The `isLeaf()` method of the `org.junit.platform.engine.support.hierarchical.Node` interface has been removed. -* The default methods `pruneTree()`, and `hasTests()` have been removed from +* The default methods `pruneTree()` and `hasTests()` have been removed from `TestDescriptor`. ===== New Features and Improvements @@ -94,6 +95,7 @@ is placed on the Java 9 module path. * The `ENGINE` enum constant was removed from `TestDescriptor.Type`. The default type of the `EngineDescriptor` is now `TestDescriptor.Type.CONTAINER`. + [[release-notes-5.0.0-m5-junit-jupiter]] ==== JUnit Jupiter @@ -116,6 +118,8 @@ is placed on the Java 9 module path. the functionality for creating an `Arguments` instance is now available via the `Arguments.of(...)` static factory method. * The `names` property of `@MethodSource` has been renamed to `value`. +* The `getTestInstance()` method in the `TestExtensionContext` API has been moved to the + `ExtensionContext` API. [[release-notes-5.0.0-m5-migration-extension-api]] .Extension API Migration @@ -133,6 +137,18 @@ is placed on the Java 9 module path. ===== New Features and Improvements +* The test instance lifecycle can now be switched from the default per-method mode to a + new per-class mode via the new class-level `@TestInstance` annotation. This enables + shared test instance state between test methods in a given test class as well as + between non-static `@BeforeAll` and `@AfterAll` methods in the test class. + - See <> for details. +* `@BeforeAll` and `@AfterAll` methods are no longer required to be `static` if the test + class is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. This enables the + following new features. + - Declaration of `@BeforeAll` and `@AfterAll` methods in `@Nested` test classes. + - Declaration of `@BeforeAll` and `@AfterAll` on interface `default` methods. + - Simplified declaration of `@BeforeAll` and `@AfterAll` methods in test classes + implemented with the Kotlin programming language. * `Assertions.assertAll()` now tracks exceptions of any type (as opposed to only tracking exceptions of type `AssertionError`), unless the exception is a _blacklisted_ exception in which case it will be immediately rethrown. @@ -149,6 +165,7 @@ is placed on the Java 9 module path. * `@TestFactory` now supports arbitrarily nested dynamic containers. See `DynamicContainer` and abstract base class `DynamicNode` for details. + [[release-notes-5.0.0-m5-junit-vintage]] ==== JUnit Vintage