Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestContext should generate cache keys based on all metadata that uniquely identify ApplicationContext configuration [SPR-7326] #11984

Closed
spring-projects-issues opened this issue Jun 27, 2010 · 1 comment
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jun 27, 2010

Daniel IfCore opened SPR-7326 and commented

I have a test suite where different test classes use the same context configuration file but different context loader. The use case for this is to be able to inject a session and request scope via the customizeBeanFactory method in the GenericXmlContextLoader class.

Since only some test cases rely on those scopes I have a @ContextConfiguration annotation on those classes that need those scopes.

Since the contextCache relies only on the locations property of the ContextConfiguration annotation the special context loader is not invoked if another test cases with the same context location has been executed before.

Could you please add the classname of the loader to the cache key as well? In Spring 3.0.2 it is in line 301 in the org.springframework.test.context.TestContext.java file.

Thanks!


Affects: 3.0.2

Issue Links:

Referenced from: commits dbe96b5, 3f58da1

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jun 3, 2011

Sam Brannen commented

This issue has been resolved in conjunction with changes made due to #12615.

Specifically, cache keys generated by TestContext are now based on the following:

  • locations (from @ContextConfiguration)
  • classes (from @ContextConfiguration)
  • contextLoader (from @ContextConfiguration)
  • activeProfiles (from @ActiveProfiles)

For details see the source of TestContext's generateContextKey() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants