Package org.junit.jupiter.api
Annotation Type BeforeAll
-
@Target({ANNOTATION_TYPE,METHOD}) @Retention(RUNTIME) @Documented @API(status=STABLE, since="5.0") public @interface BeforeAll@BeforeAllis used to signal that the annotated method should be executed before all tests in the current test class.In contrast to
@BeforeEachmethods,@BeforeAllmethods are only executed once for a given test class.Method Signatures
@BeforeAllmethods must have avoidreturn type, must not beprivate, and must bestaticby default. Consequently,@BeforeAllmethods are not supported in@Nestedtest classes or as interface default methods unless the test class is annotated with@TestInstance(Lifecycle.PER_CLASS).@BeforeAllmethods may optionally declare parameters to be resolved byParameterResolvers.Inheritance
@BeforeAllmethods are inherited from superclasses as long as they are not hidden or overridden. Furthermore,@BeforeAllmethods from superclasses will be executed before@BeforeAllmethods in subclasses.Composition
@BeforeAllmay be used as a meta-annotation in order to create a custom composed annotation that inherits the semantics of@BeforeAll.- Since:
- 5.0
- See Also:
AfterAll,BeforeEach,AfterEach,Test,TestFactory,TestInstance