How do I test a functionality with multiple inputs/expected outputs?
Here is a really simple example:
scenario "Can add two numbers", {
given "Two numbers", {
num1 = 2
num2 = 3
}
when "I trigger add.", {
result = add(num1,num2)
}
then "The result should be correct.", {
result.shouldBe 5
}
}
I want to test this with multiple values, say add(4,8).shouldBe 12, ....
Whats the best practice to do this? In other BDD frameworks I have seen table like structures to implement this, but cannot find something like that in EasyB. Should I create multiple scenarios to cover this (appending (1), (2) to the scenario name), or should I put the inputs and expected outputs into an array, and check this for equality? If I use the latter approach, how do I get meaningfull failures?