Closed
Description
Frank Scheffler opened SPR-13916 and commented
We are using Mockito mocks quite often throughout our Spring-based integration tests, which leaves us with the problem of resetting them before/after each test method. While we can use some globally defined custom TestExecutionListener to reset all the mocks found within the ApplicationContext, it would be more practical to be able to define specific event-listeners within the application context itself. This would allow for more fine-grained control over which beans (i.e. mocks) should be reset.
Deliverables
- Implement
EventPublishingTestExecutionListener
. - Implement abstract
TestContextEvent
and all concrete subclasses. - Implement composed
@EventListener
annotations for all events. - Document exception handling and async support in Javadoc.
- Document in the Testing chapter of the reference manual.
Issue Links:
- Publish TestStarted and TestCompleted events in the TestContext framework [SPR-8710] #13352 Publish TestStarted and TestCompleted events in the TestContext framework
- Introduce support for test-scoped beans in the TestContext framework [SPR-14034] #18606 Introduce support for test-scoped beans in the TestContext framework
2 votes, 6 watchers