Monday, May 7, 2012


Behavioral Driven Development (Part 1)

Behavioral driven development is all about documenting or producing the executable specification. We think in terms of various scenario’s or steps and write unit tests to verify the behavior of objects under test.


BDD is said to be superset of TDD. If you are aware of the TDD process where in we write the failing unit tests, then write the production code; verify the test to make it pass. Refactor code and verify the tests. 


One thing I would like to tell the reader is BDD is not just about unit testing. It’s about how you drive your tests with various behaviors. One has to think and come up with various scenarios for a use-case then start writing acceptance test for the same.


TDD Technique




















With BDD, we are writing a feature tests. What that means is write unit tests with the behavior in mind. We think about various scenarios and write unit tests to make it to pass.

BDD focuses on the Acceptance tests or executable specification. Think as an end user performing various steps to accomplish a particular use case/scenario. You can go with one Use case at a time and follow the acceptance tests to cover the same.



BDD Technique














The key difference what we can think of TDD and BDD is the focus on the initial design and creation of tests. With BDD we are focusing on the steps or features to achieve our goals rather than focusing on the just writing a passing test with TDD.

BDD is all about documenting the executable specification in terms on Unit tests which verifies the behavior of our system. There are many tools available for doing BDD. SpecFlow is one among the good tool that I personally suggest with which we can easily write acceptance tests describing the features.




No comments:

Post a Comment