Skip to content

Publish test execution events to the test ApplicationContext [SPR-13916] #18490

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

2 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions