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 (将#修改为@)