我有一个场景:
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 |
而这一步定义:
[Given(@"I got (.*)")]
public void Igot(string cat)
{
// will do stuff here
}
cat
方法中的参数Igot()
正在接收值"<cat>"
,而不是字符串值"1"
。
为什么?
在您的 SpecFlow 代码中,替换Scenario
为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 |
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句