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!!