Archive

Archive for August, 2008

Behavior Driven Development

August 22, 2008 1 comment

I had read some articles about BDD like Dan North’s article on BDD and the information on this site. However, I never quite got a hang of it. I’ve also looked at the Specter Framework which is a BDD framework in Boo. But again, since Boo is not used heavily (in the .Net world), it becomes a problem, because you have to install a new language / compiler etc. and then, the company you are working for, should allow its usage.

I understood the basics behind BDD, the difference in nomenclature (from TDD) but I could never start writing tests first. Then I came across this article by Scott Bellware and his SpecUnit.Net helpers for NUnit. I believe these helpers are easy to work with, once you get a hang of them. Scott left one of the specifications as an execise to the reader, so here’s my take at it –

Specification code

Specification code

And here’s the resulting change to the Account class –

Account class

Account class

I believe, that this style of writing behaviors (aka tests) first, will help us to flesh out the domain model classes (which is obviously the heart and soul of any application). However, my doubt is – is this style suited only for arriving at the domain model classes? Please let me know your views and comments.

Thanks Scott for a detailed and insightful article and the SpecUnit helpers.

Advertisements