黄瓜:黄瓜-jvm中未定义的步骤

时间:2015-06-12 07:03:43

标签: java automation cucumber cucumber-jvm

我在执行使用Cucumber框架和Java设计的测试脚本时遇到了问题。

我创建了以下步骤:

Feature: Try to login in Testsite
Scenario: Login Successfully
Given User goes to Login Page
When Enter "//*[@id='login-username']" as "userName"
When Enter "//*[@id='login-password']" as "Password"
And Click "div>button.btn.btn-lg.btn-primary.btn-block"
Then Verify title page equal "Demo – Welcome"

==>然后我将@Given步骤定义如下:

@Given("^User goes to Login Page$")
public void User_goes_to_Login_Page() throws Throwable {
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.navigate().to("demo.test.com");
throw new PendingException();
}

==>黄瓜在执行后声明:

错误的测试结束了。上次开始:[]停止:场景:登录成功; class org.junit.runner.Description

Scenario: Login Successfully # src/test/java/test/test.feature:2
Given User goes to Login Page
When Enter "//*[@id='login-username']" as "userName" # test.enterTxtField(String,String)
When Enter "//*[@id='login-password']" as "Password" # test.enterTxtField(String,String)

从语句中,运行者了解其他步骤,但无法找到@Given的实现方法。它以前工作过,但现在不能。 请帮忙。

0 个答案:

没有答案