Behavior-driven development

This is an old revision of this page, as edited by CLW (talk | contribs) at 11:55, 13 December 2005 (capitalisation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Behavior Driven Development (BDD) is a programming technique which emphasizes the specification of the behavior of software at a very fine level of granularity. BDD is a variant of or perhaps a reaction to test driven development.

It changes the focus from thinking in terms of testing to thinking about behavior. In TDD you write a test, have it fail, and then have it pass by writing code. In BDD, you think of a specification in a given context, using method names beginning with "should". These define the behavior of the class you are writing, so a method called shouldDoSomethingCool in a class FooBehavior would be read as: Class Foo should do something cool.

One of the major benefits BDD offers to "traditional" TDD is the semantic thinking of the coder. BDD says decide on the next most important thing the class doesn't do, then implement the code to make it do it. The approach of TDD is to create a failing test, then make it pass. BDD emphasizes specifications and behavior over testing.

BDD encourages behavioral specifications, clear thinking about each behavior, and looking at the specification code as executable documentation.

  • Overview of BDD [1]
  • Implementation of BDD framework [2]