-
Notifications
You must be signed in to change notification settings - Fork 480
Description
Describe the bug
Sorry for maybe not describing the problem correctly. Feel free to edit the subject line. While trying to implement an annotation-driven extension which skips remaining iterations after one iteration has failed (similar to what @Stepwise does for feature methods within a spec), I found strange behaviour which @leonard84 asked me to report as a bug in a private chat.
To Reproduce
Here is an MCVE gist:
https://gist.github.com/kriegaex/9c352493574fb0f93d9ebd9a3a4ac204
Feel free to also try it in the Groovy web console (GWC):
https://gwc-experiment.appspot.com/?g=groovy_2_5&gist=9c352493574fb0f93d9ebd9a3a4ac204
In the GWC, switch to the "Result" tab:

But it is better to run the code locally:
Spock version: 2.2.0-groovy-3.0-SNAPSHOT
run: StepwiseIterationsTest.myFeature 1
run: StepwiseIterationsTest.myFeature 2
intercept: StepwiseIterationsTest.myFeature 2
Condition not satisfied:
count != 2
| |
2 false
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsTest.myFeature #count(StepwiseIterationsTest.groovy:30)
Suppressed: org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 2
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
StepwiseIterationsTest.myFeature 2
StepwiseIterationsTest.myFeature 2
StepwiseIterationsTest.myFeature 2
If then you comment out line invocation.feature.skip(skipMessage), you see that it does not just affect skipped iterations reporting, i.e. it is not just a skip info message captured one, but actually when throwing new exceptions in interceptors of subsequent iterations, it looks the same:
Spock version: 2.2.0-groovy-3.0-SNAPSHOT
run: StepwiseIterationsTest.myFeature 1
run: StepwiseIterationsTest.myFeature 2
intercept: StepwiseIterationsTest.myFeature 2
Condition not satisfied:
count != 2
| |
2 false
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsTest.myFeature #count(StepwiseIterationsTest.groovy:30)
Suppressed: org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 2
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
intercept: StepwiseIterationsTest.myFeature 3
org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 3
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 3
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 3
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
org.opentest4j.TestAbortedException: StepwiseIterationsTest.myFeature 3
at de.scrum_master.stackoverflow.q71414311.StepwiseIterationsExtension$MyInterceptor.intercept(StepwiseIterationsTest.groovy:81)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:101)
(...)
Expected behavior
I expect the iteration info to be updated, showing the current iteration, no matter if it is being skipped or not, no matter if an error was thrown in a previous iteration's interceptor.
Actual behavior
Once the first skip or TestAbortedException was triggered, the iteration info seems to be "frozen" (not updated anymore).
Java version
I do not think it matters, but Java locally I am running JDK 17, the GWC currently runs on 11.
Buildtool version
IntelliJ IDEA, Maven POM auto import
What operating system are you using
Windows
Dependencies
x
Additional context
x