AMA: adopting a TDD/BDD approach

João Monteiro asks…

I recently joined a small company where I am the only QA and the test automation suite was already written in a given/when/then style but rarely (if not at all) gets read by the rest of the team (product or developers). Any tips on how to mentor the team to adopt a BDD approach? Do you recommend any tools / framework to share the features in a centralised place easily accessible by the rest of the team an not just on the tests repository?

I’ve seen this happen quite a lot actually. There’s probably a reason this is happening: perhaps they are hard to read? If they’re written in an imperative, detailed or step-by-step way, or focus on the implementation of business rules then the appetite from a product owner, or even a developer, to read them will be low.

I would recommend an approach of rewriting one of the specifications to be declarative: focused on the intention of the scenario and using clear examples – see Specification By Example: a Love Story for some tips. If you start with this one specification and ask for input from product owners to whether this is clear and correct, and from developers in how we could best test this specification, this increase their appetite for being more involved in these specifications.

There are a couple of tools that allow sharing these specifications online – Cucumber Pro, Relish, and SpecLog come to mind, but please keep in mind that if your specifications aren’t well written then just making them more accessible will not necessary increase the readership/collaboration that happens on these, as people could still ignore them at will.

Mohammed Yaseen also asks..

Hi Alister, I am working as Test Engineer. i would like to know about TDD and BDD and how can i implement those stuff in my project. and i would like to know how benefit it is? Any reference site/book?

My response…

I usually start looking into something via its Wikipedia article, so TDD and BDD. There’s plenty of books about TDD, since I haven’t read any I can’t recommend a particular title. For BDD there’s Specification by Example by Gojko Adzic which I would recommend.

Neither approach works in isolation from the developers at your company, so once you have just enough information about either approach I would start a conversation with a developer who you have rapport with and see whether there is some interest to pilot one approach.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.