@IgnoreRest and @Stepwise interaction

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

@IgnoreRest and @Stepwise interaction

Glyn Normington
It appears that @Stepwise and @IgnoreRest don't work together as might be expected. Suppose there are three feature methods in a stepwise test class and only the second method is annotated with @IgnoreRest. I would expect the first and second methods to execute and the third to be ignored. However, the first method is also ignored, which typically gives incorrect behaviour for a stepwise test class.

The documentation should either note a restriction and describe a workaround (in the above example, add @IgnoreRest to the first method) or the code should be fixed to behave properly.

Shall I raise an issue about this?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @IgnoreRest and @Stepwise interaction

Kostis Kapelonis
"Suppose there are three feature methods in a stepwise test class and
only the second method is annotated with @IgnoreRest. I would expect
the first and second methods to execute and the third to be ignored."

I think you got it backwards. When you mark with IgnoreRest something,
you say to Spock "Run THIS method only and ignore the rest".

The documentation says it as well.
http://spockframework.github.io/spock/javadoc/1.0/spock/lang/IgnoreRest.html
"Indicates that all feature methods except the ones carrying this
annotation should be ignored."


According to your suggestion I have tried running the following example:

@Stepwise
class BugSpec extends spock.lang.Specification{

     public void "first method"() {
      expect: "dummy test"
      1 == 1
      }

     @IgnoreRest
     public void "second method"() {
     expect: "dummy test"
     2 == 2
     }

    public void "third method"() {
     expect: "dummy test"
    3 == 3
    }
}

When it runs, the first and third method are skipped and only the
second runs. This is what I expected it to do.
You can also run the example with the Spock web console.

Did you mean something different? I don't see any problem with the
current implementation and documentation.

Kostis

On Fri, Mar 18, 2016 at 4:01 PM, Glyn Normington <[hidden email]> wrote:

> It appears that @Stepwise and @IgnoreRest don't work together as might be
> expected. Suppose there are three feature methods in a stepwise test class
> and only the second method is annotated with @IgnoreRest. I would expect the
> first and second methods to execute and the third to be ignored. However,
> the first method is also ignored, which typically gives incorrect behaviour
> for a stepwise test class.
>
> The documentation should either note a restriction and describe a workaround
> (in the above example, add @IgnoreRest to the first method) or the code
> should be fixed to behave properly.
>
> Shall I raise an issue about this?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Spock Framework - User" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/spockframework.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @IgnoreRest and @Stepwise interaction

Glyn Normington
That's certainly what @IgnoreRest is naïvely meant to operate, but the problem is it breaks @Stepwise test classes. So I'd prefer a more nuanced behaviour where @IgnoreRest combined with @Stepwise runs only the method(s) annotated with @IgnoreRest plus any methods preceding the @IgnoreRest methods.

Alternatively, if this nuanced behaviour is too complex to implement, I'd like a clear statement in the docs about the current behaviour so that users know the limitation.

On Sunday, March 20, 2016 at 9:34:38 PM UTC, Kostis Kapelonis wrote:
"Suppose there are three feature methods in a stepwise test class and
only the second method is annotated with @IgnoreRest. I would expect
the first and second methods to execute and the third to be ignored."

I think you got it backwards. When you mark with IgnoreRest something,
you say to Spock "Run THIS method only and ignore the rest".

The documentation says it as well.
<a href="http://spockframework.github.io/spock/javadoc/1.0/spock/lang/IgnoreRest.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fspockframework.github.io%2Fspock%2Fjavadoc%2F1.0%2Fspock%2Flang%2FIgnoreRest.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_6ZV6c79UUV33zYxnl7O7DED0iQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fspockframework.github.io%2Fspock%2Fjavadoc%2F1.0%2Fspock%2Flang%2FIgnoreRest.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_6ZV6c79UUV33zYxnl7O7DED0iQ&#39;;return true;">http://spockframework.github.io/spock/javadoc/1.0/spock/lang/IgnoreRest.html
"Indicates that all feature methods except the ones carrying this
annotation should be ignored."


According to your suggestion I have tried running the following example:

@Stepwise
class BugSpec extends spock.lang.Specification{

     public void "first method"() {
      expect: "dummy test"
      1 == 1
      }

     @IgnoreRest
     public void "second method"() {
     expect: "dummy test"
     2 == 2
     }

    public void "third method"() {
     expect: "dummy test"
    3 == 3
    }
}

When it runs, the first and third method are skipped and only the
second runs. This is what I expected it to do.
You can also run the example with the Spock web console.

Did you mean something different? I don't see any problem with the
current implementation and documentation.

Kostis

On Fri, Mar 18, 2016 at 4:01 PM, Glyn Normington <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Qvc-8iefBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">gnorm...@...> wrote:

> It appears that @Stepwise and @IgnoreRest don't work together as might be
> expected. Suppose there are three feature methods in a stepwise test class
> and only the second method is annotated with @IgnoreRest. I would expect the
> first and second methods to execute and the third to be ignored. However,
> the first method is also ignored, which typically gives incorrect behaviour
> for a stepwise test class.
>
> The documentation should either note a restriction and describe a workaround
> (in the above example, add @IgnoreRest to the first method) or the code
> should be fixed to behave properly.
>
> Shall I raise an issue about this?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Spock Framework - User" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Qvc-8iefBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">spockframewor...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Qvc-8iefBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">spockfr...@googlegroups.com.
> Visit this group at <a href="https://groups.google.com/group/spockframework" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/spockframework&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/spockframework&#39;;return true;">https://groups.google.com/group/spockframework.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @IgnoreRest and @Stepwise interaction

Glyn Normington
Well, I submitted a PR ([1]) which offers to clarify the docs. I'll leave it to the maintainers to decide whether or not they think it is necessary.

[1] https://github.com/spockframework/spock/pull/574

On Tuesday, March 22, 2016 at 4:11:26 PM UTC, Glyn Normington wrote:
That's certainly what @IgnoreRest is naïvely meant to operate, but the problem is it breaks @Stepwise test classes. So I'd prefer a more nuanced behaviour where @IgnoreRest combined with @Stepwise runs only the method(s) annotated with @IgnoreRest plus any methods preceding the @IgnoreRest methods.

Alternatively, if this nuanced behaviour is too complex to implement, I'd like a clear statement in the docs about the current behaviour so that users know the limitation.

On Sunday, March 20, 2016 at 9:34:38 PM UTC, Kostis Kapelonis wrote:
"Suppose there are three feature methods in a stepwise test class and
only the second method is annotated with @IgnoreRest. I would expect
the first and second methods to execute and the third to be ignored."

I think you got it backwards. When you mark with IgnoreRest something,
you say to Spock "Run THIS method only and ignore the rest".

The documentation says it as well.
<a href="http://spockframework.github.io/spock/javadoc/1.0/spock/lang/IgnoreRest.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fspockframework.github.io%2Fspock%2Fjavadoc%2F1.0%2Fspock%2Flang%2FIgnoreRest.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_6ZV6c79UUV33zYxnl7O7DED0iQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fspockframework.github.io%2Fspock%2Fjavadoc%2F1.0%2Fspock%2Flang%2FIgnoreRest.html\46sa\75D\46sntz\0751\46usg\75AFQjCNF_6ZV6c79UUV33zYxnl7O7DED0iQ&#39;;return true;">http://spockframework.github.io/spock/javadoc/1.0/spock/lang/IgnoreRest.html
"Indicates that all feature methods except the ones carrying this
annotation should be ignored."


According to your suggestion I have tried running the following example:

@Stepwise
class BugSpec extends spock.lang.Specification{

     public void "first method"() {
      expect: "dummy test"
      1 == 1
      }

     @IgnoreRest
     public void "second method"() {
     expect: "dummy test"
     2 == 2
     }

    public void "third method"() {
     expect: "dummy test"
    3 == 3
    }
}

When it runs, the first and third method are skipped and only the
second runs. This is what I expected it to do.
You can also run the example with the Spock web console.

Did you mean something different? I don't see any problem with the
current implementation and documentation.

Kostis

On Fri, Mar 18, 2016 at 4:01 PM, Glyn Normington <[hidden email]> wrote:

> It appears that @Stepwise and @IgnoreRest don't work together as might be
> expected. Suppose there are three feature methods in a stepwise test class
> and only the second method is annotated with @IgnoreRest. I would expect the
> first and second methods to execute and the third to be ignored. However,
> the first method is also ignored, which typically gives incorrect behaviour
> for a stepwise test class.
>
> The documentation should either note a restriction and describe a workaround
> (in the above example, add @IgnoreRest to the first method) or the code
> should be fixed to behave properly.
>
> Shall I raise an issue about this?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Spock Framework - User" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to spockframewor...@googlegroups.com.
> To post to this group, send email to [hidden email].
> Visit this group at <a href="https://groups.google.com/group/spockframework" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/spockframework&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/spockframework&#39;;return true;">https://groups.google.com/group/spockframework.
> For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.