Behaviour Driven Development (BDD) & tools for .Net

I had read about the behaviour driven development (BDD) quite some time back. However it was more in conceptual stage at that time. So I was looking forward to some new and actionable information to act on it.

For those who are new to BDD here are few links to get up to speed.

  1. BDD Wiki Page
  2. BehaviourDriven.Org home page
  3. Dan North’s article on introduction to BDD

What caused me write this post was one of the recent tweets by the @ScottGu pointing to an article by Rajesh Pillai (BDD using SpecFlow on ASP.NET MVC Application) and also while searching for similar stuff, I found another article with same title but little more theorotical content by Steve Sanderson (Behavior Driven Development (BDD) with SpecFlow and ASP.NET MVC).

SpecFlow & Gherkin

I tried SpecFlow first. SpecFlow is based on a language for BDD called Gherkin. Gherkin is primarily used by BDD framework for Ruby called Cucumber. (Oh and we all swear Microsoft for their product names!) To make the matters simple, here is all this in short. Gherkin is primarily a syntax/style used for writing business scenario. It has few keywords/ concepts like Feature that has Scenario that has three sections called “Given”, “When” and “Then”. Each feature has multiple scenarios and each scenario is described using the three sections. Multiple conditions in these sections are combined with And. All the lines start with either of these keywords. Phew!

So the way SpecFlow works is that is helps convert the features into nUnit Test stubs. You can add meat to each test using your own code and you can drive your development using these tests. So it is BDD by TDD principles. Steve Sanderson’s article gives a good dope on difference between BDD & TDD. While reading his article I got link to another similar framework called StoryQ.


StoryQ uses the features of extension classes in .Net and makes writing the tests even simple. It does not use Gherkin. But the feature syntax is pretty much similar to Gherkin and I have requested them to be Gherkin compliant as well. Hope they will listen. StoryQ works with both MSTest and nUnit. They have a client tool to convert the story from single a test method stub to the entire class.

Comparing StoryQ and SpecFlow

StoryQ: Pros – No frills approach, Excellent Converter, Highly readable Code, Compatible with both nUnit & MS Test. Cons – Lack of integration of feature files within projects. Unknown – How to keep the changes in stories in sync with the tests and vice a versa.

SpecFlow: Pros – direct integration of feature files in both VS 2010 & 2008. Uses Gherkin which can ensure that the feature specs will work on other platforms if needed. Cons – Complex flow for generating method stubs (Run nUnit, Get the stubs from text output window one method at a time and copy paste it into VS – yuk!) No support for MS Test (coming soon as per team).


BDD is a much cleaner and easier to understand approach compared to TDD. As a developer I never was comfortable with TDD. BDD gives a fresh paradigm to look at basically same process but has more clear line of sight for what you are trying to achieve. Out of the tools, I like StoryQ better. Their codeplex site says that the syntax is completely customizable to any DSL that you want. It needs some work though. But both tools have to be given some time to mature and feedback from enthusiasts will help both of them grow in their own space.

One thought on “Behaviour Driven Development (BDD) & tools for .Net”

  1. Hi Hemant

    If you have some ideas regarding your requirements for StoryQ I’d recommend starting a discussion at The problem with putting suggestions into a codeplex review is that there’s no way to continue the conversation.

    I’m glad you liked the tool, look forward to hearing more from you

    Regards – Rob (StoryQ co-coordinator)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: