I want to run some steps using Cucumber but I receive the following errors:
io.cucumber.junit.UndefinedStepException: The step 'I launch chrome browse' and 1 other step(s) are undefined. You can implement these steps using the snippet(s) below:
The TestRunner.class is
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/java/Features", // Path to the directory containing your feature files
glue = "StepDefinitions", // Package name where your step definitions are located
plugin = {"pretty", "html:target/cucumber-reports"} // Specify the desired reporting format
)
public class PostRunner {
// This class will be empty
// Cucumber will scan the features and step definitions based on the options provided above
// The tests will be executed based on the defined scenarios in the feature files
}
Project Structure is:
src
| +---main
| | +---java
| | | \---PageObjectModel
| | | HomePage.java
| | | LoginPage.java
| | | OnboardingPage.java
| | | PopupNotificationPage.java
| | |
| | \---resources
| | chromedriver.exe
| |
| \---test
| +---java
| | +---Features
| | | Logo.feature
| | | SignIn.feature
| | |
| | +---runner
| | | PostRunner.java
| | |
| | \---StepDefinitions
| | Stepdefs.java
| |
| \---resources
I tried:
The errors are:
io.cucumber.junit.UndefinedStepException: The step 'I launch chrome browse' and 1 other step(s) are undefined. You can implement these steps using the snippet(s) below:
or
io.cucumber.core.feature.GluePath warnWhenWellKnownProjectSourceDirectory WARNING: Consider replacing glue path 'src/test/java/StepDefinitions' with 'StepDefinitions'.
In your scenario outline you have the text 'I launch chrome browse'.
This text needs to be inside a step definition file inside a when annotation.
example:
@When("I launch chrome browse")
public void launchChrome() throws Exception {
... e.g.: some selenium stuff
}