Spock- ignore spec method for a subclass
Asked Answered
D

1

35

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?

Deflocculate answered 5/6, 2015 at 10:19 Comment(1)
You can't override an inherited test method, nor can you ignore it (at least not without writing your own Spock extension).Leiker
B
87

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
Blub answered 5/6, 2015 at 13:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.