mardi 9 mars 2021

Java Cucumber scenario is not joined with the steps code

I have a simple Cucumber feature file with 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 which 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

enter image description here

Can somebody tell me please what is wrong with it? Weird is that I have also another feature file which is in the same directory and it works well. I dont understand what happened there.

Aucun commentaire:

Enregistrer un commentaire