Below three @Then statement coming from different step definition how to resolve this in Java.
@Then("User selects {string} value")
@Then("User selects {string} and verify the value are Present in the dropdown")
@Then("User selects {string} value under placements")
public void user_selectsValue(String locatorString) throws Throwable {
locatorStr = POC_homePageMenuItems.mainButtonDropdownNewfrmData(locatorString);
elementclick(locatorStr);
}
How to get this issue resolved, in python duplicate @Then with different step definition is allowed. How to resolve this in Java
CodePudding user response:
You could use a regex OR grouping
@Then("User selects {string} (value|value under placements|and verify the value are Present in the dropdown)")
public void user_selectsValue(String locatorString, String option) throws Throwable {
but probably simpler to refactor to a single test phrase if the new option
is not used/needed.
CodePudding user response:
I guess you're using an old version of Cucumber. Since Cucumber v5 the step definition annotations are repeatable