-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Invalid duplicated methods suggested as snippets for step definitions #1930
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
Comments
Cheers! |
WOW! That was fast, thanks! |
But... isn't there any test in the commit which fixes this issue? |
That needs a bit more refactoring to make it testable. This is one of the oldest classes in Cucumber. Checked it by hand for now. |
@mpkorstanje and is there any estimation about the release of this fixed version? |
We don't do estimates. Releases are made when convenient. |
Describe the bug
When you run a JUnit 4 test given a feature file with no step definitions implemented yet, Cucumber generates snippets for methods that are duplicate in the presence of steps with captured regular expressions (which can be implemented with a single method).
To Reproduce
Take this simple feature file, where the first two steps differ only for the string literals.
and run a test case annotate with
@RunWith(Cucumber.class)
you get this output from Cucumber:The two proposed methods
public void element_with_name(String string)
are duplicate.This did not happen with Cucumber 4 (currently I'm using version 5.5.0): only a
public void element_with_name(String string)
was suggested (and indeed adverbs likeGiven
andAnd
are not taken into consideration when executing step definitions).Expected behavior
The proposed method snippets should be as follows (which is also what Cucumber 4.8.1 used to propose):
The first method is used at runtime for both When and And steps.
Context & Motivation
With Cucumber 4 you could simply copy and paste the proposed methods in a Java file as a starting point. Now, you get a compiler error because of duplicated methods.
Your Environment
The text was updated successfully, but these errors were encountered: