SpecFlow 不匹配示例字段

SpecFlow is not matching Examples fields

我有一个场景:

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
}

方法 Igot() 中的 cat 参数正在接收值 "<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    |