Behavior Driven Development

alternative to Test Driven Development?

"BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters." BDD focuses on obtaining a clear understanding of desired software behaviour through discussion with stakeholders. It extends TDD by writing test cases in a natural language that non-programmers can read. Behavior-driven developers use their native language in combination with the ubiquitous language of domain driven design to describe the purpose and benefit of their code. This allows the developers to focus on why the code should be created, rather than the technical details, and minimizes translation between the technical language in which the code is written and the domain language spoken by the business, users, stakeholders, project management, etc.

Mar'2011: Jeffrey P Shell notes that DHH isn't a big fan of the Ruby On Rails frameworks that support this: I respect the guys behind it and I'm all for experimentation, but the proliferation of rSpec and Cucumber makes me sad. Shell agrees: I'm glad that these kinds of tests have never really caught fire in the Python world. There are implementations of the R Spec and Cucumber ideas, but they don't seem to be as fully embraced. In my opinion, the dark side of testing in the Python world is the abuse of Doc Test-s, thinking that they make both good test cases and good documentation, when in fact they're neither... As David points out, the complexity going on behind the scenes to make the tests just seems silly. Granted, 'Unit Test-s' aren't always that easy to read, but they offer a finer example of API interactions. And if you want clarity, just add some comments. Take a cucumber-esque line like "verify that the file is encoded in UTF-8" and "now the file is encoded as latin-1" and put them as comments above the test/assert/verify statements that prove that line.

Edited: |

blog comments powered by Disqus