Skip to content

Support for @DirtiesContext at the test class level [SPR-4702] #9379

Closed
@spring-projects-issues

Description

@spring-projects-issues

Noel Flicken opened SPR-4702 and commented

Expected behavior:
Context should be close()'d after end of test class execution

Observed behavior:
Context only closed when @DirtiesContext annotates method

Multiple test classes can re-use the same context, which allows for faster test execution, so automatically closing a context after test class execution is probably not the best mechanism.

However, there should be a way to annotate that a context should be close()'d after all tests in a test class are executed.

Suggested fix:

  • allow @DirtiesContext to annotate class
  • add TestExecutionListener#destroyTestInstance

Willing to implementing, if given approval of design.


Issue Links:

Referenced from: commits 2dee54b, e77e070, 7782184, 0483cb5, 8dec6af, 1f087b4, 51b8b99, f26e2e3

4 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