Annotation Interface TestExecutionListeners


@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited public @interface TestExecutionListeners
TestExecutionListeners defines class-level metadata for configuring which TestExecutionListeners should be registered with a TestContextManager.

@TestExecutionListeners is used to register listeners for a particular test class, its subclasses, and its nested classes. If you wish to register a listener globally, you should register it via the automatic discovery mechanism described in TestExecutionListener.

This annotation may be used as a meta-annotation to create custom composed annotations. As of Spring Framework 5.3, this annotation will be inherited from an enclosing test class by default. See @NestedTestConfiguration for details.

Switching to default TestExecutionListener implementations

If you extend a class that is annotated with @TestExecutionListeners and you need to switch to using the default set of listeners, you can annotate your class with the following.

 // Switch to default listeners
 @TestExecutionListeners(listeners = {}, inheritListeners = false, mergeMode = MERGE_WITH_DEFAULTS)
 class MyTests extends BaseTests {
     // ...
 }
 
Since:
2.5
Author:
Sam Brannen
See Also: