grailsspock

How can I repeat Spock test?


As described here @Repeat annotation is not supported right now. How can I mark spock test as repeated n times?

Suppose I have spock test:

def "testing somthing"() {
    expect:
    assert myService.getResult(x) == y

    where:
    x | y
    5 | 7
    10 | 12
}

How can I mark it to repeat n times?


Solution

  • You can use a where-block as shown in the answer above. There is currently no way to repeat a method that already has a where-block.