I am a long time fan of TDD and after reading the RSpec book, would like to transistion to a BDD process. I like the idea of driving from the outside in, as it is presented in the book.

What I am having a hard time getting a handle on is how to structure the tests. I have tried SpecFlow, but it seems cumbersome to use when I am the only one really ever going to be looking at the tests. I like the idea of just using straight NUnit, rather then adding another framework, like it is presented here.

Is this a good way to try and structure BDD tests? Is there more information out there on comparing the two ways (that may even be more recent)?

  • @PersonalNexus dannorth.net/introducing-bdd
    – Erik L
    Jan 10, 2012 at 16:11
  • 1
    @PersonalNexus You can just click on the tag; it has an explanation on it already. It's a fairly well-known term, particularly amongst Agile devs.
    – Lunivore
    Jan 17, 2012 at 14:33
  • I can't believe nobody has picked up on your choice of the word '(cu)cumbersome' yet! Jan 26, 2012 at 9:27
  • 1
    @Stimul8d I hadn't even noticed that, lol!
    – Erik L
    Jan 26, 2012 at 18:11
  • Here's a no-nonsense library for writing Gherkin in your NUnit tests github.com/mcintyre321/Giveth Jan 10, 2019 at 9:14

2 Answers 2


It's possible to use NUnit to write BDD-level tests, just like it's possible to use SpecFlow in a completely non-behaviour-driven way. But, before I did either, I'd need a good reason why I wasn't going to use the tool built for the job.

What is it about SpecFlow that "seems cumbersome"? Why would it be good for a team and not for an individual? Is your instinct telling you that it seems cumbersome because you're inexperienced with it?

Even if it is a bit cumbersome for a one-man job, would it be good practice for using it in a bigger team later?

If you answer all those questions and you still can't see any point then by all means, use NUnit with BDD-style test names.

  • Great answer! Got me thinking. You touched on my inexperience with it, and I bet that is. Writing is probably the most difficult part, or at least, figuring out what to write. Any resources on tips on how to write out good Gherkin specifications?
    – Erik L
    Jan 10, 2012 at 18:41

If you are looking at a BDD framework to use, you need to find one that you personally feel comfortable with, and which you feel adds value. There are a number of options available for .NET, and each has several pro's and cons which you should weigh up to decide which framework provides you personally with the best balance between comfort, ease of use, and of course functionality.

I have used each of the following, and incidentally reviewed a few of them as a part of a blog entry only a couple of months ago:

I believe that there are a few others floating around, but I was unable to locate links to them while I was writing this.

Like you, I found SpecFlow - and also a few others - a little cumbersome to either install or use. I don't want to need to add additional products to support the BDD framework. I also don't like having to decorate my code with lot's of additional text or attributes which tend to add a lot of additional noise to the code. I wanted something that allowed me to simply represent my BDD test syntax in a natural flowing and easy to read manner within the code. After a lot of testing and a bit of a lengthy review process, I ended up settling on StoryQ, which I've been using for about a year now combined with NUnit and Moq. It has a couple of minor limitations to do with support for anonymous delegates which works but messes up the output, and for me the API required a tiny bit of customization to improve the story/scenario syntax, which turned out to be an easy modification to a DSL template. The limitations however were far outweighed by the ease with which I found the framework could be used, and the active support by it's creators.

This is a choice that I made after careful consideration with regards to my needs and my own particular methodology. While I would happily recommend StoryQ to anyone, I am also mindful that your own methodology and needs may be different. However to answer your question, if you are like me and convinced that BDD is a better approach when writing software test-first, then yes, you should use an appropriate BDD framework. Just make sure it is the right framework for you.

When structuring your tests, I have found two approaches that work reasonably well. One is to make all of your BDD code exist within a separate class. It's a nice way to keep your BDD code all together, and if needs be reusable, however it kind of messes with the free flow of text that makes the code really readable. The other way which I have now settled on, has been to create a base test class with all of the really common stuff that I do, such as generalized Assertions, SUT instantiation, and other common things. All of my test units descend from this base, and simply add the Assignment, Action, and specialized Assertion statements needed to complete my tests. In this way, I comfortably stick to the DRY principal, have elegantly readable test code, and I get to conform nicely with a comfortable AAA style of syntax. It works well for me, but I've needed to go through several iterations of code to get it right so to speak.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.