Never Google ‘BDD Tutorial’​

You should never, ever Google ‘BDD Tutorial’ or ‘Gherkin Tutorial’. Why? Once when I was teaching a BDD class I was walking around listening to the students working on an exercise, and noticed that one of the students had his phone out, and had some Gherkin on it. I looked more closely, and thought “Why does that Gherkin look familiar?”. Then I realized that it looked familiar because it was in my course material – in the section titled ‘Bad Gherkin’!

My student was eager to learn, and had very cleverly Googled ‘Gherkin Tutorial’, but had unfortunately found that there are far more really bad examples than there are good examples on the Internet.
 
What do I mean by bad examples? I searched ‘Gherkin Tutorial’ and clicked on the first 10 links:
 
Link #1:
 
    1. The first Scenario has seven lines, including two ‘And’ statements after the ‘When’. This isn’t a requirement, it is a script – a Gherkin anti-pattern.
    2. It says ‘I enter a credit card number that is less than 16 lines long’. ‘Less than 16’ isn’t concrete – does that mean 15? 14? 0? -1? BDD requires examples to be concrete. Gojko Adzic gave BDD a better name, ‘Specification by Example’. Examples must be concrete, exact, precise.
    3.  It talks about the interface – another Gherkin anti-pattern.
    4. Finally, the ‘Then’ isn’t concrete either.

Four mistakes in the first Scenario in this ‘Tutorial’!

Link #2:

Cucumber.io – an excellent resource!

Link #3:

This tutorial talks about using BDD to “write test cases” – but BDD isn’t about testing, it is about changing the way the Product Owner, Business Analyst, Developer, and QA communicate. It is about creating a ubiquitous language in which we can write requirements – not test scripts. Aslak Hellesoy wrote Cucumber, and in a blog post he wrote “If you think Cucumber is a testing tool, please read on, because you are wrong.”

 Link #4:

“Cucumber is a testing framework….” Aslak wrote Cucumber, and he said this isn’t true.

Link #5:
 

“Cucumber is a software tool used by the testers to develop test cases…”

Link #6:

WOW! I am shocked! Link #6 is almost giving good advice! Almost…

Link #7:
    1. Talks about the interface (a Gherkin anti-pattern)
    2. Talks about sequence (a Gherkin anti-pattern)
    3. Says ‘write a script’

I won’t keep going, but I hope you see why you should never, ever Google ‘BDD Tutorial’! You will get really, really bad advice and training. Of the first ten links that I clicked on, only one was really reliable.

SBE/BDD is an incredibly powerful methodology for communicating requirements, developing software, and delivering automated tests, and your team will really benefit if you learn to do it well. So if you can’t Google for help, where can you go to learn Specification by Example/BDD and Gherkin – and learn it really well? Contact me and I will be glad to point you to really good resources!

Leave a Comment