Bastian Voigt opened SPR-12421 and commented
Status Quo
When using the maven surefire setting parallel=methods, JUnit still creates only one runner instance per test class, i.e. one runner instance is used by multiple threads in parallel.
SpringJUnit4ClassRunner uses a single TestContextManager which stores the current TestContext in an instance field.
Proposal
SpringJUnit4ClassRunner should use a ThreadLocal instead of a single TestContextManager instance field.
Deliverables
- Improve thread safety for the
SpringRunner for JUnit 4.
- Improve thread safety for the
SpringClassRule and SpringMethodRule for JUnit 4.
- Improve thread safety for the
SpringExtension for JUnit Jupiter (in JUnit 5).
Affects: 3.0 GA
Reference URL: http://stackoverflow.com/questions/26882936/why-does-springjunit4classrunner-not-work-with-surefire-parallel-methods
Issue Links:
3 votes, 5 watchers
Bastian Voigt opened SPR-12421 and commented
Status Quo
When using the maven surefire setting
parallel=methods, JUnit still creates only one runner instance per test class, i.e. one runner instance is used by multiple threads in parallel.SpringJUnit4ClassRunneruses a singleTestContextManagerwhich stores the currentTestContextin an instance field.Proposal
SpringJUnit4ClassRunnershould use aThreadLocalinstead of a singleTestContextManagerinstance field.Deliverables
SpringRunnerfor JUnit 4.SpringClassRuleandSpringMethodRulefor JUnit 4.SpringExtensionfor JUnit Jupiter (in JUnit 5).Affects: 3.0 GA
Reference URL: http://stackoverflow.com/questions/26882936/why-does-springjunit4classrunner-not-work-with-surefire-parallel-methods
Issue Links:
3 votes, 5 watchers