Friday, March 29, 2013

Cucumber with fun

i'm a big fan of BDD and we are using cucumber-jvm on the server side. The normal BDD template is
Given something
And something else
When I do this
And I do that too
Then something good happens

And if you put this at the beginning of your feature file
# language : en-pirate 

you can do this

Gangway! something
Aye something else
Blimey! I do this
Aye I do that too
Let go an haul something good happens

Interesting!

The only thing is the locale en-pirate isn't really documented nicely (at least i couldn't find any documentation) and it's not that intuitive either. I'd expect it to be en_pirate as in en_US. I have to trace down the code and found the regular expression they use to match the locale to find out it should be a - instead of a _. 

No comments:

Post a Comment