0

Java-Cucumber : Feature file is not calling step definition file, I am trying in Intellij Idea tool. While clicking on Feature file steps(Given and Then) with CTRL button, it's redirecting to my step definition file, but while running it's throwing below error.

Connected to the target VM, address: '127.0.0.1:64966', transport: 'socket'

Undefined step: Given  I am logged in to Intersect HE as user type "administrator"

Undefined step: Then  I verify I have access the Intersect Help page

1 Scenarios (1 undefined)
2 Steps (2 undefined)
0m0.000s



You can implement missing steps with the snippets below:

Given("^I am logged in to Intersect HE as user type \"([^\"]*)\"$", (String arg1) -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});

Then("^I verify I have access the Intersect Help page$", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
});Disconnected from the target VM, address: '127.0.0.1:64966', transport: 'socket'

    enter code here

Process finished with exit code 0

After adding Glue, it's throwing other error "Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate class stepDefinitions.LoginPageStepDefs".

The stepDefinitions file is added correctly, don't know why I am getting this error.

Console Error Description Project Structure

3
  • 1
    Can you share your testRunner code, Did you mentioned glue in it?(If possible share your folder tree view) Commented Apr 5, 2017 at 15:07
  • How you are executing the feature file whether using TestRunner or directly you are running feature file? Commented Apr 5, 2017 at 15:10
  • @akarsh : I have mentioned glue and I am trying to run feature file directly. Commented Apr 6, 2017 at 13:56

2 Answers 2

0

Click on Edit Configuration as shown in below images.

Expand the drop down highlighted in the first image, then click on Edit Configurations option

enter image description here

enter image description here

In glue field Enter package name where all your step definitions are stored, as highlighted in below screenshot and save it.(verify feature file path also whether it is correct or not)

enter image description here

Let me know if you have any queries.

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried this way as well and after adding Glue it's showing other error "Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate class stepDefinitions.LoginPageStepDefs"
0

You have a class path problem. You need to share more of your setup for us to be able to help you.

Or you can make life easier and start with something that works. Clone the getting started project supplied by the Cucumber team. Then transform it to solve the problem you really want to solve. You are currently in the situation described by Gall's law:

A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.