SpecFlow 与示例字段不匹配

马特·W

我有一个场景:

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 代码中,替换ScenarioScenario 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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章