Skip to content

Commit 9b91f6b

Browse files
committed
Document @testinstance lifecycle support in the M5 Release Notes
Issue: #419
1 parent 38e1514 commit 9b91f6b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

documentation/src/docs/asciidoc/release-notes-5.0.0-M5.adoc

+21-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
*Date of Release:* ❓
55

6-
*Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers and minor
7-
API changes.
6+
*Scope:* Fifth milestone release of JUnit 5 with a focus on dynamic containers, test
7+
instance lifecycle management, and minor API changes.
88

99
WARNING: This is a milestone release and contains breaking changes. Please refer to the
1010
<<running-tests-ide-intellij-idea,instructions>> above to use this version in a version of
@@ -38,6 +38,7 @@ is placed on the Java 9 module path.
3838
| `junit-vintage-engine-<VERSION>.jar` | `org.junit.vintage.engine`
3939
|===
4040

41+
4142
[[release-notes-5.0.0-m5-junit-platform]]
4243
==== JUnit Platform
4344

@@ -69,7 +70,7 @@ is placed on the Java 9 module path.
6970
- `junit-platform-commons`: `ReflectionUtils.findAllClassesInClasspathRoot(Path, Predicate, Predicate)`
7071
* The `isLeaf()` method of the `org.junit.platform.engine.support.hierarchical.Node`
7172
interface has been removed.
72-
* The default methods `pruneTree()`, and `hasTests()` have been removed from
73+
* The default methods `pruneTree()` and `hasTests()` have been removed from
7374
`TestDescriptor`.
7475

7576
===== New Features and Improvements
@@ -94,6 +95,7 @@ is placed on the Java 9 module path.
9495
* The `ENGINE` enum constant was removed from `TestDescriptor.Type`. The default type of
9596
the `EngineDescriptor` is now `TestDescriptor.Type.CONTAINER`.
9697

98+
9799
[[release-notes-5.0.0-m5-junit-jupiter]]
98100
==== JUnit Jupiter
99101

@@ -116,6 +118,9 @@ is placed on the Java 9 module path.
116118
the functionality for creating an `Arguments` instance is now available via the
117119
`Arguments.of(...)` static factory method.
118120
* The `names` property of `@MethodSource` has been renamed to `value`.
121+
* The `getTestInstance()` method in the `TestExtensionContext` API has been moved to the
122+
`ExtensionContext` API. Furthermore, the signature has changed from
123+
`Object getTestInstance()` to `Optional<Object> getTestInstance()`.
119124

120125
[[release-notes-5.0.0-m5-migration-extension-api]]
121126
.Extension API Migration
@@ -133,6 +138,18 @@ is placed on the Java 9 module path.
133138

134139
===== New Features and Improvements
135140

141+
* The test instance lifecycle can now be switched from the default per-method mode to a
142+
new per-class mode via the new class-level `@TestInstance` annotation. This enables
143+
shared test instance state between test methods in a given test class as well as
144+
between non-static `@BeforeAll` and `@AfterAll` methods in the test class.
145+
- See <<writing-tests-test-instance-lifecycle>> for details.
146+
* `@BeforeAll` and `@AfterAll` methods are no longer required to be `static` if the test
147+
class is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. This enables the
148+
following new features.
149+
- Declaration of `@BeforeAll` and `@AfterAll` methods in `@Nested` test classes.
150+
- Declaration of `@BeforeAll` and `@AfterAll` on interface `default` methods.
151+
- Simplified declaration of `@BeforeAll` and `@AfterAll` methods in test classes
152+
implemented with the Kotlin programming language.
136153
* `Assertions.assertAll()` now tracks exceptions of any type (as opposed to only tracking
137154
exceptions of type `AssertionError`), unless the exception is a _blacklisted_ exception
138155
in which case it will be immediately rethrown.
@@ -149,6 +166,7 @@ is placed on the Java 9 module path.
149166
* `@TestFactory` now supports arbitrarily nested dynamic containers. See `DynamicContainer`
150167
and abstract base class `DynamicNode` for details.
151168

169+
152170
[[release-notes-5.0.0-m5-junit-vintage]]
153171
==== JUnit Vintage
154172

0 commit comments

Comments
 (0)