Whats BDD and how its useful?

Frankly when I heard about BDD (Behavior Driven development) I did not believe in it. OK whats BDD? Lets see about it. Below is a diagram of an agile development methodology.

Agile Development

Here (in Rails) we hear the client’s blah blah and then we immediately offer him a prototype and get his feed back. That is we code, we test it to our satisfaction and give it to the client. To know more about Rails testing click here. But the problem here is we might leave off some test cases which might not be caught by us till the last day when we have embarrassing failure. Its here where we have this BDD pop in.

In BDD we use some methodology where we make (almost) sure that there are no bugs in our  code. For behavior driven development the image is as shown

Behavior Driven Development


Note that in this diagram, the thumb pin has moved from development to test. Here in BDD we write stories first. That is what the client wants to have in the software. Next we write test cases, in which we write code that would test our application. but wait, we haven’t stared our application yet!! ( SOUNDS CRAZY EH?) Then we run the code and watch all test cases fail (lol, the people who made BDD must be nuts). Then comes the magic, the developer writes code to make the tests pass one by one. So when the developer finishes coding he would have tested everything that should have been tested.

Rails itself is a disciplined way to use Ruby for web development and Behavior Driven Development adds another safety net. Though it takes time, I strongly feel its worth it and any Rails consultant should encourage it.

To know more visit Cucumber , a way to do BDD.

And read this excellent book : Rails in Action

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: