Skip to content

Reload the application context for each test in a class with a class level annotation [SPR-5640] #10311

Closed
@spring-projects-issues

Description

@spring-projects-issues

Peter Lappo opened SPR-5640 and commented

Tests can often alter the context state, this can cause subsequent tests to fail. A class level annotion similar to @DirtiesContext would allow class level control of reloading contexts. Changing the default at the application level to reload would be possible but somewhat heavy handed and contrary to the current approach of reusing the context. A class level annotation called @DirtiesClassContext to force a context reload for each test in the class is proposed. The attached zip file In the forum contains an implemention @DirtiesClassContext that has proven to work. For convenience the classes in the implementation are packaged in the same way as spring-test.


Affects: 2.5.6

Reference URL: http://forum.springsource.org/showthread.php?p=234264#post234264

Attachments:

Issue Links:

Referenced from: commits c254f38, e31d947, eef6fd3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions