Spock Web Console

subscribe to the feed Subscribe
ParameterizedSpec (via #spockwebconsole)
tweet this script Tweet

ParameterizedSpec

Published 1 year ago by Leonard Br?ings
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
import spock.lang.*

abstract class ParameterizedBaseSpec extends Specification {

  abstract Map getParameters()

  def "first test"() {
    expect:
    parameters.a > 1
  }

  def "second test"() {
    expect:
    parameters.b < 1
  }

}

class Variant1 extends ParameterizedBaseSpec {

  @Override
  Map getParameters() {
    [a: 2, b: 0]
  }
}


class Variant2 extends ParameterizedBaseSpec {

  @Override
  Map getParameters() {
    [a: 2, b: 2]
  }
}

class Variant3 extends ParameterizedBaseSpec {

  @Override
  Map getParameters() {
    [a: 1, b: 0]
  }
}