Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spock- ignore spec method for a subclass

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?

like image 501
ps-aux Avatar asked Jun 05 '15 10:06

ps-aux


People also ask

What is @shared in Spock?

@Shared is a Spock feature that says to the reader that this variable is the same for all feature methods. It is an instruction specifically for the unit test and makes the unit test more clear for the reader.

What is Spock Lang specification?

lang. Specification class. A Spock specification can have instance fields, fixture methods, feature methods, and helper methods. We should prefer normal instance fields because they help us to isolate feature methods from each other.

What is Spock Java?

Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers.


1 Answers

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 
like image 182
dmahapatro Avatar answered Sep 21 '22 12:09

dmahapatro