A Brief Introduction into Behavior-Driven Development (BDD)

A Brief Introduction into Behavior-Driven Development (BDD)Behavior Driven Development (BDD) is a logical continuation of the Test Drive Development (or Test-Driven Development, TDD) methodology.

In BDD the software development process is arranged as in TDD but the scenario is written instead of unit tests. The scenario is actually a user story as it is treated in Agile methodologies. The scenario is written almost in a plain human language with some conventions that consequently allows this scenario to be interpreted into a test, which is applied to an application code.

Advantages of scenarios are as follows:

  • The developer is focused on how a program works, its functionality and behavior, rather than on what the program produces.
  • Writing a scenario is in fact writing a user story that makes it easy to convert a user story in a scenario and vice versa.
  • Due to simplicity of the language used to write the scenario, it can be easily read by any team member.  Even a non-techie person will see what’s wrong in case the scenario fails. Either it is because of incorrect requirements or incorrect implementation in the code.
  • The focus is not on tests, but on the behavioral specifications.

A scenario example:

If I’m not registered in the application
and try to enter the home page,
then a new page will be opened to add a new user.

A more complex example:

If I’m in the car
and a low beam is enabled,
then
If I get out of the car
and wait for 5 minutes,
then  the lights will be turned off.

The BDD methodology is more popular in the projects which are developed using dynamic (scripting) languages.

Some helpful BDD tools for development under the .NET environment:

  • SpecFlow
  • MSpec

See also:

About the Author

Artem Groshevoi

: “I was always interested in technical things. My first programming languages was Pascal, Delphi, and FoxPro. At the University I learned C# development and started to work as a freelancer. I always liked back-end programming tasks with high-load and complex requirements. Optimization of legacy applications is also one of my strong sides. Currently I’m working with C#, WPF, Silvelright, SQL, ASP.NET, WinRT, VB.NET.
As a software engineer, I try to keep learning new things: languages (Ruby, JS), methodologies (TDD, BDD, Lean), and frameworks (Rails, SignalR). I’m a founder and contributor of several open-source projects. My hobby is learning computer algorithms on coursera.org, riding bicycle, and photography.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>