Spoken Languages

Remember earlier we said that you can write your Gherkin features in the spoken language of your stakeholders? Here’s how.

Putting a # language: comment on the first line of a feature file tells Cucumber which spoken language that feature is written in. If you omit this header, Cucumber will default to English, as you’ve already seen.

Here’s an example of a feature written in Norwegian:

# language: no​​​
Egenskap:​ Summering
For å unngå at firmaet går konkurs
Må regnskapsførerere bruke en regnemaskin for å legge sammen tall​​
Scenario:​ to tall​​
Gitt ​at jeg har tastet inn 5​​
Og ​at jeg har tastet inn 7​​
Når ​jeg summerer​​
​skal resultatet være 12

If you’re wondering whether Cucumber knows ...

Get The Cucumber for Java Book now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.