Expecting that only the annotation of defined language in feature work
See original GitHub issueSummary
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:
public class StepDefinitions {
@Eğerki("^sadece bi cümle$")
@Given("^just a sentence$")
public void deneme() {
System.out.println("worked");
}
}
My feature file:
# language: tr
Özellik: Dil
Senaryo:
Eğer ki just a sentence
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
- cucumber-java: 1.2.5
- cucumber-jvm-deps: 1.0.5
- cucumber-testng: 1.2.5
- testng: 6.9.8
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
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. I need to do this for each common module.
okay, i will be able to