Description
Mukarram Baig opened SPR-9548 and commented
Lets say I have a test class called ServiceTest
with three test methods test1
, test2
, and test3
. All three methods use some resources which are provided by Spring. In the current state of affairs, if there is a problem with the loading of the spring context, the context load is retried for each test method.
Is there a way that I can have it aborted on the first failure itself with existing hook-ins?
There might be good reasons behind it - but I fail to appreciate it. Any pointers would be helpful.
The real problem is that the context load takes a few minutes, and it is useless to keep reattempting to load the context if it has already failed for the first time and only seeks to prolong the time that the CI server takes to report failures.
I was thinking of having an attemptMap
in ContextCache
that the TestContext
modifies when it encounters a failed ApplicationContext
. A repeated load will be (on an opt-in flag set) disallowed via an exception. I have attached a rudimentary patch to indicate what I meant. Sorry that I haven't tested it (don't have gradle installed or an IDE plugin that can do it for me - am still a maven boy :))
Affects: 3.1 GA
Reference URL: http://stackoverflow.com/questions/11202535/ability-to-avoid-repeated-load-of-application-context-in-spring-testcontext-via
Attachments:
- spring-test.patch (3.72 kB)
6 votes, 8 watchers