微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Cucumber+Serenity“您可以使用下面的代码片段实现缺失的步骤”

如何解决Cucumber+Serenity“您可以使用下面的代码片段实现缺失的步骤”

我使用 serenity-bdd 和 Cucumber 开发了一个测试自动化,用于移动测试。我的问题在下面。

TEST PENDING: User can login with credentials
---------------------------------------------------------------------------------

cucumber.runtime.junit.UndefinedThrowable: The step "User launch the app" is undefined

cucumber.runtime.junit.UndefinedThrowable: The step "User sees the login page" is undefined

cucumber.runtime.junit.UndefinedThrowable: The step "User enters asdf@hotmail.com to username input" is undefined

cucumber.runtime.junit.UndefinedThrowable: The step "User enters 123123 to password input" is undefined

1 Scenarios (1 undefined)
4 Steps (4 undefined)
0m0.837s


You can implement missing steps with the snippets below:

**NECESSARY METHODS IMPLEMENTATION** 

虽然我已经实现了这些方法,但我又得到了这个。我的跑步者、cucumbersteps 和功能文件如下所示。

跑步者:

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "src/test/resources/features/",glue = "cucumbersteps")
public class EbebekRunner {

}

黄瓜步骤:

class LoginSteps {

  @Steps
  EbebekLoginSteps ebebekLoginSteps;

  @Given("^User launch the app$")
  public void user_launch_the_app() {
    ebebekLoginSteps.launchApp();
  }

  @When("^User sees the login page$")
  public void user_sees_the_login_page() {
    ebebekLoginSteps.confirmloginPage();
  }

  @Then("^User enters (.*) to username input$")
  public void user_enters_to_username_input(String userName) {
    ebebekLoginSteps.enterUserName(userName);
  }

  @And("^User enters (.*) to password input$")
  public void user_enters_to_password_input(String password) {
    ebebekLoginSteps.enterPassword(password);
  }

}

特点:

Feature: Login App

  Background:
    Given User launch the app

  Scenario Outline: User can login with credentials

    When User sees the login page
    Then User enters <username> to username input
    And User enters <password> to password input

    Examples:
      | username         | password |
      | asdf@hotmail.com | 123123   |

我的项目结构如下。

enter image description here

我尝试将胶水改为 {"cucumbersteps"} 但没有任何变化。 我不明白为什么调用问题。有人可以帮我吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。