Spock- ignore spec method for a subclass

20,851

Verify the import statement for @Ignore. It should be imported from spock library instead of JUnit:

import spock.lang.Ignore

instead of

import org.junit.Ignore
Share:
20,851
ps-aux
Author by

ps-aux

Updated on July 18, 2022

Comments

  • ps-aux
    ps-aux almost 2 years

    I have a test spec in Spock and I want to apply the same tests to another alternative with exception of one method. I extend the original spec, implement some custom stuff related to the alternative and would really like to exclude the execution of one test method.

    I tried it with

    @Ignore
    def "Something must work in a certain way"() {
        //No implementation
    }
    

    but it seems that the method is called anyway.

    Can this be achieved?