Re: Ignore specific iterations of spock test?

514 views
Skip to first unread message

Peter Niederwieser

unread,
Dec 7, 2012, 2:12:36 PM12/7/12
to spockfr...@googlegroups.com
This isn't something that's supported out-of-the-box. If you are willing to dig into the extension SPI, you should be able to achieve this with a Spock extension that registers an iteration interceptor on org.spockframework.runtime.model.FeatureInfo.

Cheers,
Peter

On Dec 7, 2012, at 6:35 PM, Asif Ameer <asif...@gmail.com> wrote:

Hi,

Is there a way to ignore a specific iteration without having to comment out the data row?
This would be useful in cases where one particular data iteration is failing in current release and is to be fixed in the next...so we mark the failing test (which has a bug) as ignored with the bug ID as a comment just like for a full method.
Is there any existing solution for the above?

Many thanks,
Asif

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spockframework/-/UQEJfnyNoYAJ.
To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.

Asif Ameer

unread,
Dec 9, 2012, 12:47:25 AM12/9/12
to spockfr...@googlegroups.com
Thank you. I will look into it.

Asif Ameer

unread,
Dec 12, 2012, 12:47:56 PM12/12/12
to spockfr...@googlegroups.com
Hi,

I am able to ignore the iteration by intercepting the iteration. I simply check for a 'key' in the data table vs the key specified in the new annotation and skip the invocation if it matches.
However the iteration gets marked as 'Passed' , is there a way for me to mark the skipped iteration as "skipped" as is done by the out of the box Ignore* annotations? Using set skipped does not work and since it applies to the whole feature, does not seem correct to use either.

Thanks,
Asif

Asif Ameer

unread,
Dec 14, 2012, 5:07:01 PM12/14/12
to spockfr...@googlegroups.com
Hi,

Any advice on the above please?

Thanks,
Asif

Peter Niederwieser

unread,
Dec 14, 2012, 5:17:41 PM12/14/12
to spockfr...@googlegroups.com
There isn't currently a way to mark an iteration as skipped, but throwing an `org.junit.internal.AssumptionViolatedException` from the interceptor should work. Feel free to submit a feature request.

Cheers,
Peter

On Dec 14, 2012, at 11:07 PM, Asif Ameer <asif...@gmail.com> wrote:

Hi,

Asif Ameer

unread,
Dec 14, 2012, 9:24:53 PM12/14/12
to spockfr...@googlegroups.com
Wow! That does work. Thank you Peter!


--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
Message has been deleted

pnie...@gmail.com

unread,
Dec 24, 2014, 2:57:55 AM12/24/14
to spockfr...@googlegroups.com
On 24 Dec 2014, at 08:44, Subrahmanyam Rentala <gibral...@gmail.com> wrote:

Hi Peter, 

Thanks for the info, but is there a way to ignore an iteration rather than skipping it ?

What’s the difference?

Cheers,
Peter

signature.asc

Subrahmanyam Rentala

unread,
Dec 24, 2014, 3:10:29 AM12/24/14
to spockfr...@googlegroups.com
I got it Peter. Thanks. I rechecked. Its working as expected.
Thanks again for the solution given.

Subrahmanyam Rentala

unread,
Sep 28, 2015, 9:28:20 AM9/28/15
to Spock Framework - User
Hi Peter, 

Is there a way where I can skip/ignore the test case, but i dont want them in the JUNIT results to show them as skipped?
Please find attached image for reference.

Thanks,
Subrahmanyam
sshot.png
Reply all
Reply to author
Forward
0 new messages