serenity-js / serenity-js Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Couldn't map the 'ambiguous' to a Serenity Result #90
Comments
Hey Vijay, This happens because you have more than one step definition matching one of the cucumber steps. Cucumber marks this step as "ambiguous", passes that result to Serenity/JS, and Serenity/JS doesn't know what to do with it. Granted, it would probably improve developer experience if Serenity/JS complained saying "Looks like there's more than one step definition matching that step". You can fix this problem by making sure there's no more than one step definition (in your Hope that helps! |
Hi Jan, For now i have updated step definition and make it work. But i am wondering, in case of large application(multiple features), where some common steps involve in multiple feature, like login before proceeding with feature, Cucumber will mark step as 'ambiguous'. Regards, |
Sure; "ambiguous" means that there's no way for Cucumber to figure out which step definition should be mapped to a step. The only real way of dealing with that is by making sure there's no such ambiguity and that there's only one step def that can be associated with a step. In order to do that though the team needs some discipline around organising their step libraries (step def files) so that potentially ambiguous steps are easier to spot. For instance, you could group step definitions by feature so that related step defs live together - for example "authentication.steps.ts", "basket.steps.ts", "checkout.steps.ts", "account_management.steps.ts" etc. Does that help? Jan Ps. |
Thank you for suggestion Jan. Regards, |
No problem, happy to help. By the way, the next version of Serenity/JS will include better reporting around ambiguous steps. |
…r.js affects: @serenity-js/cucumber, @serenity-js/integration-testing ISSUES CLOSED: #90
Test throw error with 'Couldn't map the 'ambiguous' to a Serenity Result' and exit.
I have some common steps in multiple feature file and when i try to run all feature file together, i get
''Couldn't map the 'ambiguous' to a Serenity Result' error.
Example: let say i have to feature file profile.feature and account.feature with statement:
profile.feature
Given Log in option is available on home page
When Jack login to portal with validName@test.com and 1234
account.feature
Given Log in option is available on home page
When Jack login to portal with validName@test.com and 1234
When i run test, i get below error:
✖ When Jack login to portal with validName@test.com and 1234
16:55:40.800 | ActivityStarts: When Jack login to portal with validName@test.com and 1234
[16:55:40] W/launcher - Ignoring uncaught error Error: Couldn't map the 'ambiguous' to a Serenity Result
Please suggest how to fix this or suggest if i am doing in wrong way. Its common that some steps could be similar in multiple feature file.
Regards,
Vijay Singh
The text was updated successfully, but these errors were encountered: