@Target(value=TYPE) @Retention(value=RUNTIME) @Inherited @Documented public @interface TestInstance
@TestInstance
is a class-level annotation that is used to configure
the lifecycle of test instances for the annotated
test class.
If @TestInstance
is not declared on a test class, the lifecycle
mode will implicitly default to PER_METHOD
.
Note, however, that an explicit lifecycle mode is inherited within
a test class hierarchy.
Setting the test instance lifecycle mode to PER_CLASS
enables the following features.
@BeforeAll
and
@AfterAll
methods in the test class.@BeforeAll
and @AfterAll
methods in @Nested
test classes.@BeforeAll
and @AfterAll
on interface default
methods.@BeforeAll
and
@AfterAll
methods in test classes implemented with the Kotlin
programming language.Modifier and Type | Required Element and Description |
---|---|
TestInstance.Lifecycle |
value
The test instance lifecycle mode to use.
|
public abstract TestInstance.Lifecycle value