Cucumber Language Support

Profile picture for user devraj

English is the third most spoken native language in the world, after Standard Chinese and Spanish. It is the most widely learned second language and is either the official language or one of the official languages in almost 60 sovereign states.

Support is provided for other languages in Cucumber so that stakeholders can express themselves in language they are comfortable with. You can write your Gherkin Feature file in 74 Languages.

Consider multilingual website which exist in different languages and you have to assert elements in that language only. In that case you would need support for other languages than English.

In a single project, we can have Feature files in multiple languages; but for one Feature file, only one language will work.

For step definition, no languages configuration or settings are required.

Feature file in English

Feature: Search
  I want to search the website

  Given I am on the homepage

  Scenario: Keyword Search
    When I fill "search textbox" with "dress"
    Then I click "search button"

Same Feature file in French

# language: fr
Fonctionnalité: Chercher
  Je veux chercher sur le site

  Étant donné que je suis sur la page d'accueil

  Scénario: Recherche par mot clé
    Quand je remplis "champ de recherche" avec "robe"
    Alors Je clique "bouton de recherche"

Step Definition For above Feature file

@Étantdonnéque("^je suis sur la page d'accueil$")
public void je_suis_sur_la_page_d_accueil() 


@Quand("^je remplis \"([^\"]*)\" avec \"([^\"]*)\"$")
public void je_remplis_avec(String arg1, String arg2)


@Alors("^Je clique \"([^\"]*)\"$")
public void je_clique(String arg1) 


Link for all supported Languages and Keywords: Gherkin Dialect