Behavior-driven development: Difference between revisions

Content deleted Content added
Bluebot (talk | contribs)
m Fixed See also/External links error(s).
Made it less TDD vs BDD; clarified "should"; removed reference to Dan North
Line 1:
{{context}}
 
'''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 speaks to the weaknesses of thinking only in terms of testing. 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 and write functions beginning with "should". For example assertNull becomes shouldBeNull.
 
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 <tt>shouldDoSomethingCool</tt> in a class <tt>FooBehavior</tt> would be read as: ''Class Foo '''should''' do something cool.''
One of the major differences between BDD and TDD is the semantic thinking of the coder. BDD says, write a specification, then implement the code to the specification while the mindset of TDD is create a failing test, then make it pass, TDD suffers from being called a testing framework. BDD emphasizes specifications and behavior, not testing.
 
One of the major differences between BDD and TDD is the semantic thinking of the coder. BDD says, writedecide aon the next most important thing the class doesn't specificationdo, then implement the code to themake specificationit whiledo theit. The mindsetapproach of TDD is to create a failing test, then make it pass, TDD suffers from being called a testing framework. BDD emphasizes specifications and behavior, notover testing.
BDD encourages behavioral specifications, clear thinking about each behavior, and looking at the specification code as executable documentation.
 
BDD encourages behavioral specifications, clear thinking about each behavior, and looking at the specification code as executable documentation.
The term Behavior Driven Development was coined by Dan North.
 
==External links==