Home > Uncategorized > My hate/love relationship with BDD

My hate/love relationship with BDD

Some years ago I started getting into TDD. It took a bit of practice but, as some of my previous posts might suggest, I am completely hooked. BDD on the other hand… well that’s a different matter…

It was probably a good year or two after I got into TDD that I discovered BDD. BDD evolved from TDD and the claim is that it solves some of the problems involved with TDD. To me a lot of these seemed like non-issues, e.g.:

  • Q. Where do you start the TDD process? A. Well what’s the simplest test you can write that will fail and allow you to write your first line of code?
  • Q. What do you call the tests? A. Just describe what they’re proving.
  • Q. What do you test and what don’t you test? A. Test everything, duh!

I felt that Dan North had built a fuzzy and overly wordy process around something simple and elegant.

The bottom-up approach I used for TDD was comfortable with me. You start with small building blocks, gradually increasing the complexity and, over time, tie them all together to create a well build, intricate system. The BDD examples I saw were much more “Outside-In”; Start by defining a high level feature (test) and that gives you a framework within which you can start coding.

It was only recently, when I started using SpecFlow (A .NET implementation of the Cucumber framework), that things started to slot in place and BDD become a whole lot more interesting to me. Here was a framework that allowed me to easily write very high level, readable tests to express end-to-end acceptance tests that poked almost every section of my applications.

Rather than replacing my TDD process with BDD, I now augment it. I’ve got a whole bunch of high level features written up in SpecFlow and can now guarantee the functionality that the user will see. I still find the “In order to… As a… I want to…” process a bit more “wordy” than I’m comfortable with but it definitely helps to give structure to the kind of feature tests I write.

Am I as hooked on BDD as TDD? Well I wouldn’t go that far, but I’m much more on board with the process and SpecFlow is certainly going to be one of the first things I pull in from Nuget for a lot of my projects from here on!

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Tell me what you think!

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: