Cucumber: undefined steps in cucumber-jvm

454 views Asked by At

I'm having problem when executing the test-script which is designed with Cucumber framework with Java.

I have created step following:

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"

==> Then I define @Given step as below:

@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();
}

==> The cucumber states after executing:

Wrong test finished. Last started: [] stopped: Scenario: Login Successfully; 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)

From the statements, the runner understands the another steps, but cannot find the implemented method for @Given. It worked before, but now cann't. Please help.

0

There are 0 answers