How to ignore a Spock feature method in Grails 3 while running on Jenkins

It is easy to ignore a test only if the test is run in a particular environment thanks to the @IgnoreIf Spock annotation. If you run your tests in Jenkins, it is probable that the tests are being run by a user called jenkins. Thus, you can ignore a test in a Jenkins Job easily:

@Integration(applicationClass = Application.class)
class IntegrationSpec extends Specification {

    @IgnoreIf({ System.getProperty("") == 'jenkins' })
    def "test will be ignored in jenkins"() {

Tags: #grails #spock
May 2016, 02.


My next events:
🗓 Apr 04 16:30 JDevSummitIL Getting Started with the Micronaut Framework