使用示例块时,黄瓜步骤不与步骤定义绑定
Cucumber step not binding with step definitions when using Example block
我在 java 中使用黄瓜。当我尝试从示例块传递值时,步骤不与步骤定义绑定。在特征文件上抛出步骤未定义的步骤引用错误。
特征文件代码:
Scenario Outline: Verify "Create your account" button on the Profile screen for Guest user
Given I launched the app
When I skip the On-boarding flow
And I tap on continue with free lessons button
And I tap on Profile tab
Then the output should be <output>
Then I should be able to see <text> on profile screen
And I enter Username as <username> and Password as <username>
And I tap create your account button on profile screen
Then I should redirected to Create your account screen
Examples:
| text | output | username | pwd |
|Register now| 5000 | sam | willis |
我试过的步骤定义代码:
@Then("I should be able to see {string} on profile screen")
public void i_should_be_able_to_see_register_now_to_save_your_xp_and_access_your_full_profile_on_profile_screen(String text) {
profile = new Profile();
Assert.assertTrue(profile.verifyLevelTagForGuestUser(text));
}
@Then("I should be able to see <text> on profile screen")
public void iShouldBeAbleToSeeTextOnProfileScreen(String output) {
profile = new Profile();
Assert.assertTrue(profile.verifyLevelTagForGuestUser(output));
}
@When("^I enter Username as \"([^\"]*)\" and Password as \"([^\"]*)\"$")
public void I_enter_Username_as_and_Password_as(String arg1, String arg2) {
}
@And("I enter Username as <username> and Password as <username>")
public void iEnterUsernameAsUsernameAndPasswordAsUsername() {
}
如有任何帮助,我们将不胜感激。
步骤定义图像:
您的程序在特征文件上出现未定义步骤引用错误,因为您有 重复 列 headers 文本为 用户名.
| text | output | username | username |
您可以将其更改为:
| text | output | username | password |
在参数周围加上双引号后,现在工作 fine.Thanks
特征文件代码:
Scenario Outline: Verify "Create your account" button on the Profile screen for Guest user
Given I launched the app
When I skip the On-boarding flow
And I tap on continue with free lessons button
And I tap on Profile tab
Then the output should be "<output>"
**Then I should be able to see "<text>" on profile screen**
And I enter Username as "<username>" and Password as "<username>"
And I tap create your account button on profile screen
Then I should redirected to Create your account screen
Examples:
| text | output | username | pwd |
|Register now| 5000 | sam | willis |
我在 java 中使用黄瓜。当我尝试从示例块传递值时,步骤不与步骤定义绑定。在特征文件上抛出步骤未定义的步骤引用错误。
特征文件代码:
Scenario Outline: Verify "Create your account" button on the Profile screen for Guest user
Given I launched the app
When I skip the On-boarding flow
And I tap on continue with free lessons button
And I tap on Profile tab
Then the output should be <output>
Then I should be able to see <text> on profile screen
And I enter Username as <username> and Password as <username>
And I tap create your account button on profile screen
Then I should redirected to Create your account screen
Examples:
| text | output | username | pwd |
|Register now| 5000 | sam | willis |
我试过的步骤定义代码:
@Then("I should be able to see {string} on profile screen")
public void i_should_be_able_to_see_register_now_to_save_your_xp_and_access_your_full_profile_on_profile_screen(String text) {
profile = new Profile();
Assert.assertTrue(profile.verifyLevelTagForGuestUser(text));
}
@Then("I should be able to see <text> on profile screen")
public void iShouldBeAbleToSeeTextOnProfileScreen(String output) {
profile = new Profile();
Assert.assertTrue(profile.verifyLevelTagForGuestUser(output));
}
@When("^I enter Username as \"([^\"]*)\" and Password as \"([^\"]*)\"$")
public void I_enter_Username_as_and_Password_as(String arg1, String arg2) {
}
@And("I enter Username as <username> and Password as <username>")
public void iEnterUsernameAsUsernameAndPasswordAsUsername() {
}
如有任何帮助,我们将不胜感激。
步骤定义图像:
您的程序在特征文件上出现未定义步骤引用错误,因为您有 重复 列 headers 文本为 用户名.
| text | output | username | username |
您可以将其更改为:
| text | output | username | password |
在参数周围加上双引号后,现在工作 fine.Thanks
特征文件代码:
Scenario Outline: Verify "Create your account" button on the Profile screen for Guest user
Given I launched the app
When I skip the On-boarding flow
And I tap on continue with free lessons button
And I tap on Profile tab
Then the output should be "<output>"
**Then I should be able to see "<text>" on profile screen**
And I enter Username as "<username>" and Password as "<username>"
And I tap create your account button on profile screen
Then I should redirected to Create your account screen
Examples:
| text | output | username | pwd |
|Register now| 5000 | sam | willis |