为了账号安全,请及时绑定邮箱和手机立即绑定

SpecFlow 与示例字段不匹配

SpecFlow 与示例字段不匹配

C#
天涯尽头无女友 2022-10-15 15:08:46
我有一个场景: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"。为什么?
查看完整描述

1 回答

?
慕哥6287543

TA贡献1831条经验 获得超10个赞

在您的 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    |


查看完整回答
反对 回复 2022-10-15
  • 1 回答
  • 0 关注
  • 58 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信