Scala BDD tool supporting Gherkin reusable parameterized offers

Is there any BDD tool for Scala that supports Gherkin's reusable parameterized offers?

I would like to be able to use features like these:

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 

And I would like to identify bindings to Hunter's sentences that differ only in one parameter, something like:

 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") } 

Based on the definitions of the articles as follows:

 "number $number is entered" { calculator.enter(number) } "'$key' is pressed" { calculator.press(key) } "result is $number" { assert(calculator.getDisplayedNumber === number) } 

I looked through the ScalaTest and Specs manuals, but I did not find such an option. ScalaTest seems to be able to reuse a specific sentence in another scenario, but it looks like it is not parameterized.

Do you know some tools that support what I want, or, for example, some extensions for ScalaTest, or a way to extend it to such a result?

+6
source share
1 answer

We can find the following example in specs2 to implement Given When Then specifications: https://github.com/etorreborre/specs2/blob/1.6/src/test/scala/org/specs2/examples/GivenWhenThenSpec.scala

Hope this helps.

+5
source

Source: https://habr.com/ru/post/901936/


All Articles