@Target(value={ANNOTATION_TYPE,METHOD}) @Retention(value=RUNTIME) @Documented @API(status=STABLE, since="5.0") public @interface AfterAll
@AfterAll
is used to signal that the annotated method should be
executed after all tests in the current test class.
In contrast to @AfterEach
methods, @AfterAll
methods are only executed once for a given test class.
@AfterAll
methods must have a void
return type,
must not be private
, and must be static
by default.
Consequently, @AfterAll
methods are not
supported in @Nested
test classes or as interface default
methods unless the test class is annotated with
@TestInstance(Lifecycle.PER_CLASS)
. @AfterAll
methods may optionally declare parameters to be resolved by
ParameterResolvers
.
@AfterAll
methods are inherited from superclasses as long as
they are not hidden or overridden. Furthermore,
@AfterAll
methods from superclasses will be executed before
@AfterAll
methods in subclasses.
@AfterAll
may be used as a meta-annotation in order to create
a custom composed annotation that inherits the semantics of
@AfterAll
.
BeforeAll
,
BeforeEach
,
AfterEach
,
Test
,
TestFactory
,
TestInstance