有没有支持可重用参数化 Gherkin 子句的 Scala BDD 工具?
我希望能够使用以下规范:
我希望能够使用以下规范:
Given number 4 is entered
When "+" is pressed
And number -1 is entered
And "*" is pressed
And number 2 is entered
And "=" is pressed
Then result is 6
我希望能够定义数据样例到Gherkin语句中,只需要通过参数区分,例如:
scenario("(4+(-1)) * 2 = 6") {
given("number 4 is entered")
when("'+' is pressed")
and("number -1 is entered")
and("'*' is pressed")
and("number 2 is entered")
and("'=' is pressed")
then("result is 0")
}
鉴于以下类似以下的从句定义:
"number $number is entered" {
calculator.enter(number)
}
"'$key' is pressed" {
calculator.press(key)
}
"result is $number" {
assert(calculator.getDisplayedNumber === number)
}
我查看了ScalaTest和Specs的手册,但没有找到这样的功能。ScalaTest似乎能够在不同的场景中重用已定义的条款,但看起来它是不能参数化的。
您知道有哪些工具支持我想要的功能,或者例如ScalaTest的一些扩展,或者通过自己扩展ScalaTest来实现这样的结果的方法吗?