Reputation: 1391
I am trying to create row tests using SpecFlow and the Microsoft built-in Test Framework, something along these lines:
Scenario Outline: Test Calculator Given I have entered <x> into the calculator And I have entered <y> into the calculator When I press add Then the result should be <result> on the screen Examples: | x | y | result| | 1 | 2 | 3| | 2 | 2 | 4|
The problem I am facing is that given any step in the Scenario Outline a separate step method is auto-generated for each value from the Examples table. I would like to be able to implement for each step a generic method receiving input values as parameters but it just does not seem to work.
Upvotes: 1
Views: 872
Reputation: 897
I had this same problem in VS 2012. I think it may be a bug with SpecFlow, because when I change the Scenario Outline to only be a Scenario, it generates everything correctly. All the documentation says you should not have to surround the placeholders in quotes.
In short, my solution is to change it to a Scenario to generate the steps. But don't forget, you have to change it back to a Scenario Outline to compile. This is what is working for me.
Upvotes: 0
Reputation: 1391
In the end it looks like it works as expected, what I was missing were quotes around input parameters placeholders:
Scenario Outline: Test Calculator Given I have entered "<x>" into the calculator And I have entered "<y>" into the calculator When I press add Then the result should be "<result>" on the screen Examples: | x | y | result| | 1 | 2 | 3| | 2 | 2 | 4|
Upvotes: 2