I have a simple Cucumber feature file with a simple scenario. It looks like:
Feature: Admin login
As user I want to login
To have access to admin
Scenario: Login in with valid credentials and open Admin page
Given Login with valid credentials
When Click on admin link
Then Check admin page
I also have a AdminLoginSteps file that contains Java code. It looks like:
package steps;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class AdminLoginSteps
{
@Given("Login with valid credentials")
public void loginWithValidCredentials() {
}
@When("Click on admin link")
public void clickOnAdminLink() {
}
@Then("Check admin page")
public void checkAdminPage() {
}
}
I dont know if it is important but paths to this files are: C:\SeleniumTests\cucumber.tatrytec.eu\src\test\features\AdminLogin.feature C:\SeleniumTests\cucumber.tatrytec.eu\src\test\java\steps\AdminLoginSteps.java
But as I try to run the feature scenario it throws me an error:
Step undefined
You can implement missing steps with the snippets below
Here is a screenshot:
Can somebody tell me please what is wrong with it? The weird part is that I have also another feature file which is in the same directory and it works well. I don't understand what happened there.
It seems the feature file and steps files did not have the same name to link each other.