-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Duplicate step definitions should not be allowed #678
Comments
Hello Could you please check how pure cucumberjs solves this problem? We would like to match cucumber behavior as much as possible |
It's not allowed in cucumber-js (I've replicated that behavior in my fork). |
Thanks for confirming that for me @badeball . I've opened a PR with a proposed fix for this. Please let me know if you think it is suitable or needs additional work. |
Due to personal reasons, the previous maintainers of this package are stepping down and handing the reigns over to me, a long-time contributor to the project and a user of it myself. This is a responsibility I'm very excited about. Furthermore, I'd like to thank @lgandecki ++ for all the work that they've done so far. Read more about the transfer of ownership here. The repository has however moved and all outstanding issues are being closed. This is not a reflection of the perceived importance of your reported issue. However, if after upgrading to the new version, you still find there to be an issue, feel free to open up another ticket or comment below. Please make sure to read CONTRIBUTING.md before doing so. |
@badeball I am facing Multiple-step definitions found error when we have same step definition description in two different feature files. For example, I have two different feature files like login.feature, forgetPassword.feature. I have a common step Given(''Open the browser and load the URL''), in both feature files. How to handle this scenario? i believe this error will display only when we have duplicate steps in same feature file, not for two different feature files. Please provide your thoughts on this #Cypress 10.2 |
@JomyGeo, you're making it impossible for me to help you. You have to show me an example that I can correct (and don't make it difficult by doing that with screenshots or large bodies of code, give me a cloneable repository that illustrates your folder structure). |
@badeball |
@badeball Could you please check the above repo and provide us an update for the same |
@badeball Do we have an option to pass stepDefinition file path on runtime (Terminal) as we pass it for Spec path(.Feature file)? Because when I set the Stepdefiition as a global pattern in package.json then Before() Hook runs every time which is not related to that spec file. #750 Current behaviour : Expected behaviour : |
Looks right, but again it's difficult to tell because you're giving me an example of what you're doing and not exactly what you're doing. |
The command does set the environment variables |
@badeball It didn't work for me. All i want here is to override the stepDefinitions and filterSpecs environment variable values in runtime. But it is not working for me. Cypress script executing based on the value in cypress.config.js , not run time. cypress run -e stepDefinitions='cypress/e2e/StepDefinitions/Product_Steps/**/*.js' --browser='electron' |
Well, what have to tried so far? I only see two commands which sets each separately, how have you tried to set them simultaneously? |
@badeball I run the below commands seperately , Not at same time cypress run -e stepDefinitions='cypress/e2e/StepDefinitions/Product_Steps/**/*.js' --browser='electron' |
Then I don’t understand what’s the issue here. |
The problem here is that I could not override the value in runtime. In some cases, I want to change the stepDefinition folder value im runtime. The below code didn't work for me. Please guide to sort out this problem cypress run -e stepDefinitions='cypress/e2e/StepDefinitions/Product_Steps/**/*.js' --browser='electron' |
Saying "it didn't work" simply doesn't help me and I give up now. This wasn't a support forum to begin with and you've turned out to be too difficult to deal with. I recommend that you try SO. |
Current behavior
Currently the pre-processor allows duplicate step definition implementation to be present and just silently picks the first step definition it finds. This is counter to my understanding of good practice with BDD frameworks where a single step definition should have a single implementation so that the natural language gherkin phrases have a consistent and deterministic behaviour.
Note I'm just considering the general case here. I'm not saying that if you have a custom step definition for a specific feature file in a matching folder it couldn't match an existing common step (although I would argue that is probably bad practice from a BDD perspecive).
Desired behavior
I think the framework should reject / refuse to process a set of feature files if it cannot resolve step definitions down to a single implementation.
Test code to reproduce
Feature file:
Implementation:
Versions
The text was updated successfully, but these errors were encountered: