Cucumber Specflow:对场景和场景大纲使用相同的步骤定义

Cucumber Specflow:对场景和场景大纲使用相同的步骤定义,cucumber,specflow,gherkin,Cucumber,Specflow,Gherkin,我的功能文件包含一个用于测试成功登录的“场景”测试和一个用于测试应不成功的多个登录详细信息的“场景大纲”测试 @web Scenario: Successful login Given I have entered username 'tomsmith' and password 'SuperSecretPassword!' into the application When I login Then I should be informed that login was

我的功能文件包含一个用于测试成功登录的“场景”测试和一个用于测试应不成功的多个登录详细信息的“场景大纲”测试

@web
Scenario: Successful login
    Given I have entered username 'tomsmith' and password 'SuperSecretPassword!' into the application
    When I login
    Then I should be informed that login was successful

@web
Scenario Outline: Unsuccessful login
    Given I have entered username <username> and password <password> into the application
    When I login
    Then I should be informed that login was unsuccessful

    Examples: 
    | testing                          | username | password             |
    | invalid combination 1            | test     | test                 |
    | special characters               | $$$      | SuperSecretPassword! |
问题是场景大纲测试没有运行,它们返回一个“挂起”错误:挂起:找不到一个或多个步骤的匹配步骤定义

并建议步骤定义应为:

[Given(@"I have entered test and test into the application")]

有人能帮忙吗?

您的问题在这条线上:

Given I have entered username <username> and password <password> into the application
假设我已在应用程序中输入用户名和密码
应该是

Given I have entered username '<username>' and password '<password>' into the application
假设我已在应用程序中输入用户名“”和密码“”

你刚刚漏掉了
标记

作为旁白,我很想把所有的场景都放在大纲中,并有一个额外的列,其中包含
true
false
的结果,并将最后一步改为
,然后我会被告知成功登录是“”
,但谢谢Sam,现在可以了。我还将考虑您的建议,将场景结合起来,因为这样做更有意义!再次感谢Hanks Sam。我还不能提高投票率,因为我的声誉<15,但我能够将问题标记为已回答。一旦我有了必要的名声,我会记下来回来做这件事!
Given I have entered username '<username>' and password '<password>' into the application