I have a scenario:
Scenario: Check all these numbers
Given I got <cat>
When I get string <string>
Then I see result <result>
Examples:
| cat | string | result |
| 1 | a | 1=a |
| 2 | b | 2=b |
| 3 | c | 3=c |
And this step definition:
[Given(@"I got (.*)")]
public void Igot(string cat)
{
// will do stuff here
}
The cat
parameter in method Igot()
is receiving the value "<cat>"
, not the string value "1"
.
Why?
In your SpecFlow code, replace Scenario
with Scenario Outline
:
Scenario Outline: Check all these numbers
Given I got <cat>
When I get string <string>
Then I see result <result>
Examples:
| cat | string | result |
| 1 | a | 1=a |
| 2 | b | 2=b |
| 3 | c | 3=c |