Skip to content

Add a setDirty method to AbstractTestNGSpringContextTests [SPR-5305] #9978

@spring-projects-issues

Description

@spring-projects-issues

Oran Kelly opened SPR-5305 and commented

When using AbstractTestNGSpringContextTests / AbstractTransactionalTestNGSpringContextTests it is not possible to programmatically "dirty" the application context -- the only way to discard the context is via the @DirtiesContext annotation which is at the 'method' level of granularity. As a result it is not (easily) possible to have an application context discarded after all methods in a particular test class have executed.

It would be nice, in a test class that has subclassed AbstractTestNGSpringContextTests, to be able to implement a method such as:

@AfterClass
public void setContextDirty() {
    super.setDirty();
}

... thereby discarding the initialized application context from the TestContextManager's context cache.


Affects: 2.5.4

Reference URL: http://forum.springframework.org/showthread.php?t=63592

Issue Links:

2 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: testIssues in the test modulestatus: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions