-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Expecting that only the annotation of defined language in feature work #1543
Comments
Same here |
Hi bro, same issue |
👍 this will be great for our test library i18n. I don't like it when regexps are separate from source. |
This is an interesting feature request. Without going into its merits, to achieve it a significant amount of re-engineering of cucumbers core is needed. Briefly:
So before we discuss this features merit; would any of you be able to volunteer your time? |
okay, i will be able to |
I'll work with @kaygisiz and try to make it into 4.3.0 |
Excellent. This will be a breaking change so we can't introduce it until v5. There is a It would perhaps also be good to look at #1426 and #1458. The By making parameter types part of the glue this localization become easier. For example with the code below the steps @Donnée("une {chose}")
public void a_thing(Thing thing){
....
}
@Given("a {thing}")
public void a_thing(Thing thing){
....
} By defining the parameter types in the glue however it becomes possible to make a distinction here.The french and English parameter could be transformed using a different locale (recognizable by the language of the annotation). @Paramètre(name="chose", pattern=".*")
public Thing parseThing(double d)(
return new Thing(d);
}
@Parameter(name="thing", pattern=".*")
public Thing parseThing(double d)(
return new Thing(d);
} |
I also do have some questions about the merit of this feature. On it's face I can see that this the proper way to do things when developing features in multiple languages at the same time. However I have never encountered this in practice. Could you give me a concrete real world example of this? |
Actually, I do have some common step defs that I use for many clients and I package them in jars. Some clients want these functions in local language, so I need to package them separately. |
Fair enough. |
I haven't seen any activity on this since. Feel free to reopen if/when some progress is made. |
Is there any update on this? I would think that adding a language to the anotation would allow at least IDE plugins to deal with it maybe even the cucumber parser? |
Summary
When I define the language of feature using “# language:”, i am expecting that only the annotation of that language work, and others don’t. Just like how The localized keywords work and Given/When/Then does not.
My stepdef class:
My feature file:
in above example, i can't write 'Given' but i can write a 'Given' step after 'Eğerki'. I think this is a syntax error.
Expected Behavior
Test should fail either with a no step definition found or with kind of a wrong language message when defined language in feature file and language of called method's stepdef annotation doesn't match.
Current Behavior
Cucumber allows you write steps from any language defined in step definitions.
Possible Solution
Cucumber core/expressions doesn’t store language of the expression. The lang of annotation should be stored along with the regexp and shoudl be check during pickle matching.
Context & Motivation
I am trying to support selectable multiple languages in my project that using cucumber. I am planning to write multiple annotations for different languages on each method annotation and the user will just see step definitions of the selected language in the IDE.
There is also the rare case that step definitions from different languages may cause duplicate step definition errors.
Environment
The text was updated successfully, but these errors were encountered: