1

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.

Radu M.
  • 1,271
  • 2
  • 14
  • 19

2 Answers2

2

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|
Radu M.
  • 1,271
  • 2
  • 14
  • 19
  • hmm strange. The [official documentation](https://github.com/techtalk/SpecFlow/wiki/Unit-test-providers) says that VS2010 does NOT support rowtests. – Jowen Jun 11 '12 at 14:10
  • I have the same problem with VS 2012 update 2. The strange thing is that I write some features without quote in update 1, and it works like a charm. Probably something change since that. – Ouarzy May 14 '13 at 13:31
0

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.

Matt Zappitello
  • 785
  • 2
  • 11
  • 30