@Ignore and @Requires together...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

@Ignore and @Requires together...

Karthik Krishnamurthy
Hi,
In our test suite we added a bunch of tests with @Requires(SomeTag)
When we add @Ignore to a subset of these tests, for some reason they do not get ignored. Looks like @Requires takes precedence over @Ignore? Is this true, and if so is there any work around (other than to remove the @Requires tag)

Thx
Karthik

--
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 http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: @Ignore and @Requires together...

Kostis Kapelonis
Hello

@Requires is essentially the opposite of @Ignore (or more correctly
@Ignoreif). So I am not sure that it is valid to have both of them on
a test from a logical point of view.

With the current implementation, Spock will process the annotations in order.

So if you mark the test with @Ignore and then @requires, the test will
run as you noticed. But if you do the opposite the test will be
ignored.

@Requires({ new CreditCardProcessor().online() })
@Ignore
def "credit card charge happy path"() {

The example above ignores the test.

Notice however that this is undocumented, and perhaps in a future
Spock release it might change. So I would not really trust this
solution.
Instead I would just comment out the Requires annotation.

Kostis

On Fri, Sep 4, 2015 at 6:46 PM, Karthik Krishnamurthy
<[hidden email]> wrote:

> Hi,
> In our test suite we added a bunch of tests with @Requires(SomeTag)
> When we add @Ignore to a subset of these tests, for some reason they do not
> get ignored. Looks like @Requires takes precedence over @Ignore? Is this
> true, and if so is there any work around (other than to remove the @Requires
> tag)
>
> Thx
> Karthik
>
> --
> 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 http://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 http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Loading...