Thanks for joining meToday we are going to step through a crash course on Cucumber & GherkinWe will:Start with the benefitsProvide a brief primer on the mechanicsProvide an end-to-end exampleAnd cover the different approaches to gherkin feature writingSound good?OK – let’s get started
Why do Acceptance Test Driven Development?Well, [step through pic]It also helps the team work with confidence
#1 – in this case, English#2A common language between the business and the tech teamHelping you understand better what needs to be builtAnd, helps the business better understand what you are building#3 Cucumber is a communication tool more than anything – automation is just a secondary benefit#4 Examples are powerful stuffThey have the power to turn high-level acceptance criteria into specific & actionable acceptance tests (either to be carried out manually, or, with automation)They also engage our brains enabling us to visualize scenarios & figure out edge cases we may otherwise miss#5 This is all buttressed by the idea of describing the behavior of an application you are hoping to verify
So, really, it’s not just about automation, it’s about communication. To bring this point home, here’s a quote from the creator of Cucumber
Okay, let’s change gears and step through the mechanics of CucumberCucumber uses Gherkin which is a universalTo be clear -- Gherkin can be used in other BDD frameworks that use other programming languagesFor our purposes, we’ll be using Cucumber & RubySo, in Cucumber, there is a default folder structure – let’s step through it
Capybara API: https://gist.github.com/428105
Basic example (from end-to-end earlier)
Extend it – there are two additional keywordsBut may be indicative of the need for another scenarioBut your mileage may varyDepends on the readability and if it works for you and the team
The words don’t matter to Cucumber. They should matter to YOU
This seems much more readable – don’t you think?
Helper text – aka User Stories can go here
Freedom to specify data in different ways – e.g. headings down the site, or just specify a listThe pipes’ spacing doesn’t matter to Cucumber