groovy - How to use IgnoreIf in Spock, when I check the variable? -


i need skip functions in program, should depend on variable defined in same program. how can it?

def skip = true  @ignoreif({ skip }) def "some function" () { .. } 

another way using 's configuration file include/exclude tests or base classes.

first create own annotations , place on tests.
write spock configuration file.
when run tests can set spock.configuration property configuration file of choice.
way can include/exclude tests , base classes want.

example of spock configuration file:

runner {     println "run tests"     exclude enva } 

your test:

@enva def "some function" () {     .. } 

you can run :

./gradlew test -pspock.configuration=myspockconfig.groovy 

here github example


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -