Annotation Type BeforeTestExecution
@Retention(RUNTIME) @Target({METHOD,ANNOTATION_TYPE}) @Documented @EventListener(BeforeTestExecutionEvent.class) public @interface BeforeTestExecution
@EventListenerannotation used to consume aBeforeTestExecutionpublished by theEventPublishingTestExecutionListener.This annotation may be used on
@EventListener-compliant methods within a Spring testApplicationContext— for example, on methods in a@Configurationclass. A method annotated with this annotation will be invoked as part of theTestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext)lifecycle.Event processing can optionally be made conditional via a SpEL expression — for example,
@BeforeTestExecution("event.testContext.testMethod.name matches 'test.*'").The
EventPublishingTestExecutionListenermust be registered in order for this annotation to have an effect — for example, via@TestExecutionListeners.- Since:
- 5.2
- Author:
- Frank Scheffler, Sam Brannen
- See Also:
BeforeTestExecutionEvent
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description StringvalueAlias forEventListener.condition().
Element Detail
value
@AliasFor(annotation=EventListener.class, attribute="condition") String value
Alias forEventListener.condition().- Default:
- ""