I'm gettin the AmbiguousStepDefinitionsException with the log:
cucumber.runtime.AmbiguousStepDefinitionsException: ✽.Given I am logged out(features/performance.feature:7) matches more than one step definition:
^I am logged out$ in PerformanceListSteps.i_am_logged_out()
^|I should be on |the list page$ in LoginSteps.i_should_be_on_the_list_page()
While running the cucumber tests. I'm kinda fresh with this attitude and I'd be really glad for help.
The problem lies in the second regex pattern:
^|I should be on |the list page$
The pipe (|
) symbol is an alteration. So this regex basically means it will match one of the alternatives:
|
)I should be on
the list page
A regex matching an empty string will can match 0 characters, so it will match against any string. This somewhat depends on the implementation, but in the case of Cucumber-JVM I confirmed that if I added a similar regex pattern to one of my step definitions, it matched against all steps in the project.
The best solution here would be to remove the pipes from the regex, as (usually) you want the regex to be as specific as possible, leaving variations only for variables that go into the step definition.
So what you need here is to change the regex pattern to:
^I should be on the list page$
It will match steps with that statement following any of the Gherkin keywords (Given
/When
/Then
etc.), e.g.:
Then I should be on the list page