Stepan Koltsov opened SPR-8710 and commented
Status Quo
AFAIU currently test initialization and finalization code must be placed into a test class (not in the application context), so code cannot be easily reused between unrelated test classes.
Proposal
SpringJUnit4ClassRunner could publish a TestStartedEvent before each test method and a TestFinishedEvent after each test in the application context. Listeners to these events could be used to clean caches from the previous test run, recreate database state before a test method, etc.
Issue Links:
Stepan Koltsov opened SPR-8710 and commented
Status Quo
AFAIU currently test initialization and finalization code must be placed into a test class (not in the application context), so code cannot be easily reused between unrelated test classes.
Proposal
SpringJUnit4ClassRunnercould publish aTestStartedEventbefore each test method and aTestFinishedEventafter each test in the application context. Listeners to these events could be used to clean caches from the previous test run, recreate database state before a test method, etc.Issue Links: