-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Description
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:
- dirtyclass.zip (2.13 kB)
Issue Links:
- ApplicationContext not closed when using @ContextConfiguration to implement integration tests [SPR-5395] #10068 ApplicationContext not closed when using
@ContextConfigurationto implement integration tests - Support for @DirtiesContext at the test class level [SPR-4702] #9379 Support for
@DirtiesContextat the test class level