Search code examples
javacucumberappiumcalabashcucumber-java

Is there any Alternative of --guess in java runcukes


i am getting an error `cucumber.runtime.AmbiguousStepDefinitionsException: ✽.Then I should validate my username with expected value (features/sanity.feature:32) matches more than one step definition: ^I should validate ([^"]*) with expected value in UserSteps.iShouldValidateWithExpectedValue(String) ^I should validate my username with expected value$ in HomeSteps.iShouldValidateMyUsernameWithExpectedValue()

`

When i run with calabash i use to add "--guess" in the run command.

But Don't know how to resolve the same in CucumberJvm in Java.

Is there any possiblities to add this in @cucumberoptions ?

Am using the maven dependency

<dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
    </dependency>

Solution

  • --guess is not an option that you can set in the command line runner. Recall that cucumber can always guess wrong. I recommend that you simply change a few words near the beginning of the failing statement to make sure that that statement is unique. Better safe than sorry.

    Searching through the cucumber-jvm source, there is at least one reference to --guess being set by default.