question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expecting that only the annotation of defined language in feature work

See original GitHub issue

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:

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:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ooktaycommented, Feb 1, 2019

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.

1reaction
kaygisizcommented, Jan 29, 2019

okay, i will be able to

Read more comments on GitHub >

github_iconTop Results From Across the Web

Natural Language Annotation for Machine Learning [Book]
Annotated corpora can be used to train ML algorithms. In this chapter we will define what a corpus is, explain what is meant...
Read more >
Gherkin Reference - Cucumber Documentation
Gherkin uses a set of special keywords to give structure and meaning to executable specifications. Each keyword is translated to many spoken languages; ......
Read more >
Web Annotation Data Model - W3C
Abstract. Annotations are typically used to convey information about a resource or associations between resources. Simple examples include a ...
Read more >
Semantic Features Analysis Definition, Examples, Applications
Semantic analysis is defined as a process of understanding natural language (text) by extracting insightful information such as context, ...
Read more >
How do I type hint a method with the type of the enclosing class?
TL;DR: As of today (2019), in Python 3.7+ you can turn this feature on using a "future" statement, from __future__ import annotations ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found