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

Report
Question

Please briefly explain why you feel this question should be reported .

Report Cancel

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.

in progress 0
Automation 2 Answer 3536 views 2

Answers ( 2 )

  1. Thanh Huynh
    0
    June 10, 2015 at 5:24 pm

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    @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 :D
  2. Phuoc Nguyen
    1
    June 11, 2015 at 1:33 pm

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    Thanks anh. ;)

Leave an answer

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Phuoc Nguyen R

About [Phuoc Nguyen]