Pamela Gillaspie - 19 July 2016
TestPlant released eggPlant v16.1 this month, and I’m writing to talk to you about my favorite of the marquee features: support for Gherkin, the language of the Cucumber BDD framework. (Cue the vegetable puns!) Throughout our internal beta and in our v16.1 webinars, I’ve heard some great questions about Gherkin and our implementation of it that I’d like to share here. (I will also unabashedly share my preoccupation with Pokémon Go.)
What is Gherkin, again?
Gherkin is a language that you can use to write business-readable test cases. The steps of those test cases are linked to automation scripts that run when you execute the test cases.
Who uses Gherkin?
The “classic” Gherkin user is a tester or business analyst whose expertise is in his or her domain (such as finance or healthcare) but not necessarily in test automation. As an example, let’s say we’re working on Pokémon Go, because that would be really fun…
On our team we have a Pokémon expert named Robert who knows everything about what needs to be tested in Pokémon Go. Robert would use Gherkin to write test scenarios like this one:
Scenario: Buy Pokémon incense
Given I have 80 or more coins
When When I buy Pokémon incense
Then I get Pokémon incense
We also have a tester named Vera. She doesn’t know that much about the game (I know, who is this person?) but she is an experienced eggPlant user. For every Given, When, and Then that Robert writes, Vera writes a SenseTalk function to automate that step in the scenario. Then, when she runs the scenario, those functions are automatically called in turn.
Is there any value in Gherkin if you don’t separate tester roles?
Yes. At TestPlant, where test automation is our business domain, the same testers work on both devising tests and writing automation scripts, and they have enjoyed working with Gherkin. What they like about it is that it naturally encourages script modularity and re-use. Going back to the example above, once Vera has written functions for the steps in Robert’s scenario, those functions can be used over and over again, even when details change (such as the number of coins required to make a purchase.) Another benefit of feature files is that they serve as easily maintained documentation of what’s being tested. (Who wants to write separate documentation? Not this Pokémon trainer.)
Do you have to use Gherkin in eggPlant Functional now?
Can you use your existing feature files in eggPlant Functional?
Absolutely. Just move those files into a suite and write your accompanying step definitions in a SenseTalk script.
For more information on the new Gherkin support, please see the eggPlant Functional documentation, or better yet, give it a try!
P.S. As of now, myPokémon incense tests are all passing, but you can never be too vigilant.