I am using Geb with Spock and I'd like to introduce tests tagging. It's easily doable in Spock using a syntax:
runner {
if (!System.properties.containsKey('test.include.slow')) {
exclude Slow
}
}
This would exclude all the tests annotated with @Slow
if test.include.slow
property is not found. Unfortunatelly putting exclude
into GebConfig.groovy
doesn't really do it, because there's no such method to use there.
Is there a way to use this exclude
method with Geb?
Since you're using spock, you can use @IgnoreIf at the class or method level.
Here's a good article on it: http://mrhaki.blogspot.com/2014/06/spocklight-ignore-specifications-based.html
Since you have a system property for it, you should just be able to plug it right in:
@IgnoreIf({ !System.properties.containsKey("test.include.slow") })