Spock Web Console

subscribe to the feed Subscribe
sisg - 05 Spock Basics: Parameterized Tests - Table (via #spockwebconsole)
tweet this script Tweet

sisg - 05 Spock Basics: Parameterized Tests - Table

Published 3 months ago by Matthias Schulz with tags sisg Spock Basics Parameter
Actions  ➤ Edit In Console Back To Console Show/Hide Line Numbers View Recent Scripts
package parameter

import spock.lang.Specification
import spock.lang.Unroll

// This tag lists each parameterized test separately:
@Unroll
class ParameterizedTableSpec extends Specification{

    def "multiply #name"() {
        expect:
        factor * factor == product

        where: "Test data"
        name      | factor | product
        "Test 3²" |  3     |       9
        "Test 4²" |  4     |      16
        "Test 5²" |  5     |      25
        "Test 6²" |  6     |      36
    }
}