Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / testing

BDD Cheatsheet for Writing Good Specifications by Example

0.00/5 (No votes)
24 Jan 2016CPOL 6.8K  
This is a guide for QA and Devs to use to make writing high quality BDDs.

Introduction

It’s tough to write good BDD stories at times, to switch context from code to unit tests to BDD examples, all require different mindsets. The following are some guidelines or a cheatsheet if you may on how to get the best out of specifications by examples:

  • Clearly define the scenario / and or goal
  • Support business rules with specific examples
  • Aim for easy understanding maintenance
    • Prefer tables over text
    • Examples should clearly indicate input and outputs
    • Group related examples and use appropirate text / labels for each group
    • Avoid implementation details (UI interactions, extraneous system out, etc.)
  • Use examples and counter-examples relevant to each rule
  • Don’t bloat with setup data irrelevant to the specification
  • Use domain knowledge consistently
  • Focus on a few key examples (not an exhaustive set)
  • Separate and provide links to closely related concepts

Any questions, please fire away and reach out to me, always happy to discuss posts!

Please note that this is a quick guide and more indepth articles on using Specflow, Cucumber, and BDD coding practices will be coming to a blog near you soon!!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)