Cucumber: undefined steps in cucumber-jvm although step is definitely defined.

Hi all,
I'm having problem when executing the test-script which is designed with Cucumber framework with Java.
I have created step following:
{code}
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"
{code}

==> Then I define @Given step as below:
{code lang=java}
@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();
}
{code}

==> The cucumber states after executing:
{code}
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)

{code}

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.

2 Comments

  1. Thanh Huynh

    @Phuoc,

    I’d love to help but I don’t have any experience with Cucumber. Also the question is technical that it’s hard to debug without see the problem. Anyway, let’s see if we are having Cucumber expert here and ready to give suggestion 😀

  2. Phuoc Nguyen

    Thanks anh. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 AskTester

Theme by Anders NorenUp ↑