You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@Stepwise does not automatically trigger previous features anymore with Spock 2.x as well as with Gradle 2.12+ #1593
But Spock-2xx has moved to junit5 from junit4
I think it is integration problem with junit5.
But @stepwise is do affect which tests are executed, not the order see javadoc.
" Also notice that if you run a single step (e.g. from the IDE's context menu), all prior steps will also be run."
this is exactly my case
/**
Demonstrates how {@code@stepwise} causes a spec to be run in incremental steps.
Change a step's condition from {@literal true} to {@literal false}, and observe
how the remaining steps will be skipped automatically on the next run.
Also notice that if you run a single step (e.g. from the IDE's context menu),
all prior steps will also be run.
{@code@stepwise} is particularly useful for higher-level specs whose
methods have logical dependencies.
@SInCE 0.4
*/ @stepwise
class StepwiseExtensionSpec extends Specification {
Well, seems that comment is wrong.
If you checkout the spock-1.x branch which is the last commit before switching to Spock 2.x you see that it behaves exactly the same, just as I said. :-)
If this ever worked like mentioned in the comment, then this changed even longer ago.
It's not a Spock 1 vs. Spock 2 issue.
The behavior is identical between spock-1.x branch and master.
If you delegate the test execution in IntelliJ to Gradle, only step 3 is executed.
If you do not delegate test execution in IntelliJ to Gradle, all three steps are executed.
I did a little bisect, this broke with commit spockframework/spock-example@3d454b9 which changed Gradle version from 2.8 to 3.2.1.
So something in Gradle changed that makes this not work any longer.
I narrowed it down further, with Gradle 2.11 it still worked, with Gradle 2.12 it does not work anymore.
I'm transferring this issue to the main spock repository where it belongs.
changed the title [-]spock 2.1 @Stepwise not work (junit5 issue?)[/-][+]@Stepwise does not trigger previous features when run through Gradle since Gradle 2.12[/+]on Mar 9, 2023
changed the title [-]@Stepwise does not trigger previous features when run through Gradle since Gradle 2.12[/-][+]@Stepwise does not automatically trigger previous features when run through Gradle since Gradle 2.12[/+]on Mar 9, 2023
changed the title [-]@Stepwise does not automatically trigger previous features when run through Gradle since Gradle 2.12[/-][+]@Stepwise does not always automatically trigger previous features[/+]on Mar 9, 2023
Gradle 2.11 + Spock 1.0 => works
Gradle 2.12 + Spock 1.0 => does not work
IntelliJ (without Gradle delegation) + Spock 1.3 => works
IntelliJ (without Gradle delegation) + Spock 2.0 => does not work
Maven 3.6.0 + Spock 1.3 => works
Maven 3.6.0 + Spock 2.0 => does not work
So changes in Spock 2.0 made it break and additionally changes in Gradle 2.12 made it break.
changed the title [-]@Stepwise does not always automatically trigger previous features[/-][+]@Stepwise does not automatically trigger previous features anymore with Spock 2.x as well as with Gradle 2.12+[/+]on Mar 9, 2023
@marcphilipp can you maybe have a look?
We have a test using a MethodSelector that works perfectly fine.
But when for example testing a Maven-run, only the ClassSelector comes in.
So without too much deeper analysis, I'd guess they only use the ClassSelector and do the method filtering themselves somehow which then breaks this Spock functionality.
But can it really be that Maven, Gradle, and IntelliJ use JUnit platform incorrectly and all cause the same issue here?
Or is there something Spock can do to fix this?
Yep, all three let JUnit Platform only filter for the right class and then use a post-discovery filter instead of a method selector to select the requested test. Maybe also because some support patterns like step*.
I'm not sure Spock can do much about this without significant effort.
Yes @Vampire is right, unless we break/ignore the JUnit Platform Execution model we can't fix this in Spock. If the tools would use the proper MethodSelector then Spock also adds the necessary methods back in, however they remove the nodes after the discovery.
Well, I wouldn't (and didn't) say "we can't fix".
We can also dynamically add test nodes for data driven tests, so at least with some effort we could most probably also execute those features even if they fell through the post discovery filter.
Activity
Vampire commentedon Mar 9, 2023
This is not different from Spock 1 though, is it?
Afair
@Stepwisealways only affected the order, not which tests are executed.dartilla commentedon Mar 9, 2023
Yes Spock is not different.
But Spock-2xx has moved to junit5 from junit4
I think it is integration problem with junit5.
But @stepwise is do affect which tests are executed, not the order see javadoc.
" Also notice that if you run a single step (e.g. from the IDE's context menu), all prior steps will also be run."
/**
{@code @stepwise} is particularly useful for higher-level specs whose
*/
@stepwise
class StepwiseExtensionSpec extends Specification {
[-]spock 2.1 @Stepwise not work[/-][+]spock 2.1 @Stepwise not work (junit5 issue?)[/+]Vampire commentedon Mar 9, 2023
Well, seems that comment is wrong.
If you checkout the
spock-1.xbranch which is the last commit before switching to Spock 2.x you see that it behaves exactly the same, just as I said. :-)If this ever worked like mentioned in the comment, then this changed even longer ago.
dartilla commentedon Mar 9, 2023
Comment is not wrong. Just checked it in 7d231048 - last commit in spock-1x branch.
Use case:
Vampire commentedon Mar 9, 2023
It's not a Spock 1 vs. Spock 2 issue.
The behavior is identical between
spock-1.xbranch andmaster.If you delegate the test execution in IntelliJ to Gradle, only
step 3is executed.If you do not delegate test execution in IntelliJ to Gradle, all three steps are executed.
I did a little bisect, this broke with commit spockframework/spock-example@3d454b9 which changed Gradle version from 2.8 to 3.2.1.
So something in Gradle changed that makes this not work any longer.
I narrowed it down further, with Gradle 2.11 it still worked, with Gradle 2.12 it does not work anymore.
I'm transferring this issue to the main
spockrepository where it belongs.[-]spock 2.1 @Stepwise not work (junit5 issue?)[/-][+]@Stepwise does not trigger previous features when run through Gradle since Gradle 2.12[/+][-]@Stepwise does not trigger previous features when run through Gradle since Gradle 2.12[/-][+]@Stepwise does not automatically trigger previous features when run through Gradle since Gradle 2.12[/+]Vampire commentedon Mar 9, 2023
Running through Maven also does not trigger the previous features
Vampire commentedon Mar 9, 2023
Ah, sorry, I probably made too many different tests.
Indeed now
masterwithout Gradle delegation also only runsstep 3here.[-]@Stepwise does not automatically trigger previous features when run through Gradle since Gradle 2.12[/-][+]@Stepwise does not always automatically trigger previous features[/+]Vampire commentedon Mar 9, 2023
So to summarize:
Gradle 2.11 + Spock 1.0 => works
Gradle 2.12 + Spock 1.0 => does not work
IntelliJ (without Gradle delegation) + Spock 1.3 => works
IntelliJ (without Gradle delegation) + Spock 2.0 => does not work
Maven 3.6.0 + Spock 1.3 => works
Maven 3.6.0 + Spock 2.0 => does not work
So changes in Spock 2.0 made it break and additionally changes in Gradle 2.12 made it break.
[-]@Stepwise does not always automatically trigger previous features[/-][+]@Stepwise does not automatically trigger previous features anymore with Spock 2.x as well as with Gradle 2.12+[/+]Vampire commentedon Mar 9, 2023
@marcphilipp can you maybe have a look?
We have a test using a
MethodSelectorthat works perfectly fine.But when for example testing a Maven-run, only the
ClassSelectorcomes in.So without too much deeper analysis, I'd guess they only use the
ClassSelectorand do the method filtering themselves somehow which then breaks this Spock functionality.But can it really be that Maven, Gradle, and IntelliJ use JUnit platform incorrectly and all cause the same issue here?
Or is there something Spock can do to fix this?
Vampire commentedon Mar 9, 2023
Yep, all three let JUnit Platform only filter for the right class and then use a post-discovery filter instead of a method selector to select the requested test. Maybe also because some support patterns like
step*.I'm not sure Spock can do much about this without significant effort.
Add pending feature test for issue spockframework#1593
leonard84 commentedon Mar 10, 2023
Yes @Vampire is right, unless we break/ignore the JUnit Platform Execution model we can't fix this in Spock. If the tools would use the proper
MethodSelectorthen Spock also adds the necessary methods back in, however they remove the nodes after the discovery.Vampire commentedon Mar 10, 2023
Well, I wouldn't (and didn't) say "we can't fix".
We can also dynamically add test nodes for data driven tests, so at least with some effort we could most probably also execute those features even if they fell through the post discovery filter.
Add pending feature test for issue #1593
leonard84 commentedon Mar 10, 2023
It is not something that an extension, like
@Stepwise, can do at the moment.I'm not saying it is impossible to do, but they will be awkward workarounds.
Run dependency features even if they were filtered out by post discov…
Run dependency features even if they were filtered out by post discov…
Run dependency features even if they were filtered out by post discov…
Run dependency features even if they were filtered out by post discov…