Recently I started to develop my software using Behaviour-Driven Development approach and, since my preferred programming language is PHP, I chose one of the most popular existing acceptance testing tool, namely Behat.
Behat tests a feature by executing its scenarios’ steps in a context. It allows you to write your user stories in the natural language taking advantage of Gherkin language syntax.
Afterwords I chose to write user stories in my native language and Behat helped me by providing Italian gherkin keyword translations. At this time it supports 62 native languages.
In order to know the Gherkin keyword translation for the Italian language you must digit in console:
behat --story-syntax --lang=it
# language: it
Funzionalità: Internal operations
In order to stay secret
As a secret organization
We need to be able to erase past agents' memory
Contesto:
[Date|Dati|Data|Dato] there is agent A
E there is agent B
Scenario: Erasing agent memory
[Date|Dati|Data|Dato] there is agent J
E there is agent K
Quando I erase agent K's memory
Allora there should be agent J
Ma there should not be agent K
Schema dello scenario: Erasing other agents' memory
[Date|Dati|Data|Dato] there is agent <agent1>
E there is agent <agent2>
Quando I erase agent <agent2>'s memory
Allora there should be agent <agent1>
Ma there should not be agent <agent2>
Esempi:
| agent1 | agent2 |
| D | M |
Using behat in Web applications I like the Behat extension for Mink, a browser emulator abstraction layer. It hides emulator differences behind a single consistent API and represents a bridge towards real browser emulators such as
Mink extension supports 17 different languages so I found the Italian XLIFF file, in the source code, (see github) containing the patterns of Italian sentences recognized by the library.
Apart some English PDF cheatsheets I have not found much readable native language syntax documentation about Behat and Mink. (Let me know if you know).
So, to fill the gap, I developed the Behat-Gherkin/Mink Translator in order to generate on the fly the native language syntax documentation that PHP developers can use for their job.
Thas’all folks! Stay tuned!