我的特性文件包含了一个成功登录的“场景”测试和一个用于测试多个登录细节的“场景大纲”测试,这些测试应该是不成功的。
@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 username '(.*)' and password '(.*)' into the application")]
public void GivenIHaveEnteredUsernameAndPasswordIntoTheApplication(string p0, string p1)
{
login = new LoginPage();
login.with(p0, p1);
}问题在于,方案大纲测试没有运行,它们返回一个“挂起”错误:未决:一个或多个步骤没有找到匹配的步骤定义。
并建议步骤定义应是:
[Given(@"I have entered test and test into the application")]有人能帮忙吗?
发布于 2015-11-12 12:08:20
你的问题就在这条线上:
Given I have entered username <username> and password <password> into the application它应该是
Given I have entered username '<username>' and password '<password>' into the application你刚刚错过了'标记
https://stackoverflow.com/questions/33670048
复制相似问题