Cucumber fails to recognize steps definition (Intellij, Java Maven)

I created a java maven project (java v22) in intellij with junit, cucumber-junit, cucumber-java, cucumber-picocontainer, and selenium-java maven dependencies (all cucumber from io.cucumber v. 7.18.0,and selenium is 4.22.0, while junit is 4.13.2). I created a "features" folder in the root directory, and inside there a file called Ebay_Home.feature with the content:
Feature: Ebay Home Page Scenarios
Scenario: Advanced Search Link
Given I am on Ebay Home Page
When I click on Advanced Link
Then I navigate to Advanced Search Page
Feature: Ebay Home Page Scenarios
Scenario: Advanced Search Link
Given I am on Ebay Home Page
When I click on Advanced Link
Then I navigate to Advanced Search Page
And then in ./src/test/java, I created a directory called "steps" with java file called EbayHome_Steps.java with the content:
package steps;

import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

public class EbayHome_Steps {
@Given("I am on Ebay Home Page")
public void iAmOnEbayHomePage() {
//print something
}
@When("I click on Advanced Link")
public void iClickOnAdvancedLink() {
//print something
}
@Then("I navigate to Advanced Search Page")
public void iNavigateToAdvancedSearchPage() {
//print something
}
}
package steps;

import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

public class EbayHome_Steps {
@Given("I am on Ebay Home Page")
public void iAmOnEbayHomePage() {
//print something
}
@When("I click on Advanced Link")
public void iClickOnAdvancedLink() {
//print something
}
@Then("I navigate to Advanced Search Page")
public void iNavigateToAdvancedSearchPage() {
//print something
}
}
The content (printing something) doesnt matter, but my problem is when I right click Ebay_Home.feature file and click Run 'Feature: Ebay_Home' in intellij, I get an error about that there are no steps defined... Anyone know how to fix this? Its a bare project - totally new that I just created these two files in.
6 Replies
JavaBot
JavaBot8mo ago
This post has been reserved for your question.
Hey @Steadhaven! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
stechy1
stechy18mo ago
Hi, you may need to set the glue path for cucumber with information where steps are... I usually create a Suite class in the parent package where I also define a "cucumber glue" with package with steps.
Steadhaven
SteadhavenOP8mo ago
Thanks a lot
JavaBot
JavaBot8mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Steadhaven
SteadhavenOP8mo ago
it fixed my problem
JavaBot
JavaBot8mo ago
Post Closed
This post has been closed by <@305362010374406144>.

Did you find this page helpful?