Spock Web Console

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

Shared Parameters

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.*

// Hit 'Run Script' below
class MultiParamSpec extends Specification {
  @Shared
  def parameterSet = [
    [a: 1, b: 2],
    [a: 3, b: 4],
    [a: 5, b: 2]
  ]

  @Unroll
  def "test 1"() {
    expect:
    Math.max(params.a, params.b) == params.c

    where:
    params << parameterSet 
  }

  @Unroll("Testing Min(#params.a, #params.b) == #params.c")
  def "test 2"() {
    expect:
    Math.min(params.a, params.b) == params.c

    where:
    params << parameterSet 
  }
}