Skip to content →

Category: BDD

BDD, Cucumber, .Net & Specflow


On the first day of my first proper software development role in London I  was handed the amazing book Pragmatic Unit Testing in C# with NUnit by my software development manager and told to read it. It is a great book but I always struggled to apply the principles into my daily workflow. I absolutely believe in everything that TDD tries to achieve, however I have never managed to find the right balance of Unit Tests/Integration Tests.

I have work with some awesome developers who have all struggled to apply TDD into their everyday workflow (So it’s not just me!!).

The majority of projects I have worked on have been very data focused and often I have had to work with crappy frameworks that were difficult to unit test. MS Commerce Server being one of them.

I have always been interested in what the Ruby On Rails community do and I have been following their BDD experiments for some time.

The Rails guys dont seem to be afraid of their databases and have incorporated it directly into their stack. They seem to be less worried about mocking out dependencies,  or running against test data, they just get on a build, creating tests as they go.

So I started looking more closely at Cucumber, a BDD framework used commonly in the Rails community.

Straight away I could see a way of organising tests and building a regression pack that would start adding value to our team, and then I found SpecFlow.

Its genius

The Specflow guys have taken the DSL used in Cucumber and added a code generator so that you can use it with a testing framework. We have it set up with NUnit and already within a couple of days we are flying with it.


Finally things seem comfortable. The language makes sense to everybody, testers, BAs and devs alike. The output of the tests is slowly moulding itself into the way we make and describe our code, and it is driving some really interesting discussion about when is something done. Plus it is helping us in planning, as very quickly user stories are getting blown out with more requirements than would have normally been addressed in the first round of planning.

Getting started with Specflow is easier than you could imagine.  This screen cast is 30mins long, but it covers everything you need to know to get up and running.

Enjoy and happy testing.

Leave a Comment