Annotation Type AfterSuite
-
@Target(METHOD) @Retention(RUNTIME) @Documented @API(status=MAINTAINED, since="1.13.3") public @interface AfterSuite@AfterSuiteis used to signal that the annotated method should be executed after all tests in the current test suite.Method Signatures
@AfterSuitemethods must have avoidreturn type, must bestaticand must not beprivate.Inheritance and Execution Order
@AfterSuitemethods are inherited from superclasses as long as they are not overridden according to the visibility rules of the Java language. Furthermore,@AfterSuitemethods from superclasses will be executed after@AfterSuitemethods in subclasses.The JUnit Platform Suite Engine does not guarantee the execution order of multiple
@AfterSuitemethods that are declared within a single test class or test interface. While it may at times appear that these methods are invoked in alphabetical order, they are in fact sorted using an algorithm that is deterministic but intentionally non-obvious.In addition,
@AfterSuitemethods are in no way linked to@BeforeSuitemethods. Consequently, there are no guarantees with regard to their wrapping behavior. For example, given two@BeforeSuitemethodscreateA()andcreateB()as well as two@AfterSuitemethodsdestroyA()anddestroyB(), the order in which the@BeforeSuitemethods are executed (e.g.createA()beforecreateB()) does not imply any order for the seemingly corresponding@AfterSuitemethods. In other words,destroyA()might be called before or afterdestroyB(). The JUnit Team therefore recommends that developers declare at most one@BeforeSuitemethod and at most one@AfterSuitemethod per test class or test interface unless there are no dependencies between the@BeforeSuitemethods or between the@AfterSuitemethods.Composition
@AfterSuitemay be used as a meta-annotation in order to create a custom composed annotation that inherits the semantics of@AfterSuite.- Since:
- 1.11
- See Also:
BeforeSuite,Suite