Matteo Mirk
12/06/2021, 9:12 AMclass PriceSpec : StringSpec({
withData(
nameFn = { "goods=${it.goods}" },
// data rows
) { (goods, total) ->
price(goods) shouldBe total
}
"test incremental" {
...
}
})
Originally there were 2 tests, then I transformed the first into a ddt, but I lost its name wrapping the generated cases. I would like to give a name to the ddt, but If I put the withData() declaration inside a string block it’ll fail at runtime, and if I wrap it with a context(“name”) as shown in the docs, only the second test will be executed. What am I doing wrong?Matteo Mirk
12/06/2021, 11:39 AMsam
12/06/2021, 5:03 PMsam
12/06/2021, 5:03 PMMatteo Mirk
12/06/2021, 5:07 PM"test totals" - { // container block -> OK
withData(
nameFn = { "goods=${it.goods}" },
// data rows
) { (goods, total) ->
price(goods) shouldBe total
}
}
"test incremental" { // leaf block, same as in StringSpec
...
}
sam
12/06/2021, 5:29 PM