I have two shopping hava files:
Shopping.java---------
package com;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
public class Shopping {
@Given("I want to buy IphoneX")
public void I_want_Iphone() {
System.out.println("I want to buy an iPhone");
}
@And("it should be 64GB")
public void spacereq() {
System.out.println("It should be 64Gb");
}
@And("it should be black")
public void colorReq() {
System.out.println("Black color");
}
@When("I go to http://amazon.in")
public void loadSite() {
System.out.println("Go to amazon.in");
}
@And("I search for IphoneX")
public void search() {
System.out.println("Iphone X search");
}
}
Shopping2.java
package com;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class Shopping2 {
@Then("All search results should have IphoneX")
public void searchRes() {
System.out.println("All search results should have IphoneX");
}
@When("I select first search result")
public void selectSearchResult() {
System.out.println("Select first search result");
}
@Then("Next Page should open with the result")
public void nextPageValidation() {
System.out.println("Next Page should open with the new result");
}
}
Runner.java
package com;
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
public class MyRunner {
}
Console
I want to buy an iPhone
It should be 64Gb
Black color
Go to amazon.in
Iphone X search
All search results should have IphoneX
Select first search result
Next Page should open with the new result
It should be 64Gb
Black color
Instructor
Ashish Thakur Replied on 20/04/2019
I guess your mappings from feature files are not OK