Skip to content
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

Deprecate And and But keywords #1787

Closed
mpkorstanje opened this issue Oct 4, 2019 · 3 comments
Closed

Deprecate And and But keywords #1787

mpkorstanje opened this issue Oct 4, 2019 · 3 comments

Comments

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Oct 4, 2019

Summary

The And and But keywords are used as syntactic sugar in Gherkin. For example an And step precedented by a Given step is itself a Given step. As such there is no need for lambdas and annotations for And and But.

Allowing step definitions to be written with And and But might result in the creation of that do do not either arrange, act or assert something.

See: #1780

@mpkorstanje mpkorstanje added the ⚡ enhancement Request for new functionality label Oct 4, 2019
@mpkorstanje mpkorstanje added this to the 5.x.x milestone Oct 4, 2019
@mpkorstanje mpkorstanje mentioned this issue Oct 4, 2019
4 tasks
@mpkorstanje mpkorstanje removed the ⚡ enhancement Request for new functionality label Oct 4, 2019
@aslakhellesoy
Copy link
Contributor

My biggest issue with And in step definitions is that it carries an implicit and ambiguous coupling to another previous step definition. By removing it we avoid such confusion.

@mpkorstanje
Copy link
Contributor Author

How would you avoid that coupling?

Given a user named Carl
And feature toggle X is enabled
When Carl does a thing
Then something happened

Being able to turn on a feature toggle implies the existence of some user.

It could be rewritten as:

Given feature toggle X is enabled for Carl
When Carl does a thing
Then something happened

And implicitly create a user named Carl, but that gets complicated quickly. It's easier to enable the feature toggle for whom ever is the current acting user.

@mpkorstanje mpkorstanje modified the milestones: 5.x.x, 6.0.0 Dec 6, 2019
@mpkorstanje mpkorstanje modified the milestones: 6.0.0, v6.x.x Apr 17, 2020
@mpkorstanje mpkorstanje removed this from the v6.x.x milestone Jun 23, 2020
@mpkorstanje
Copy link
Contributor Author

mpkorstanje commented Oct 31, 2020

I'm closing this. Technically it is possible to deprecate and eventually remove the keywords but I don't think it is worth the impact on existing projects nor is it worth the implementation effort. The suggested snippets already avoid the use of And and But so that should curb new usages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants