Click here to Skip to main content
13,191,040 members (66,467 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 31 Oct 2011

Quick Tip: How to do TDD/BDD and Debug Unit Tests with Visual Studio Express Editions

, 9 Nov 2011
Rate this:
Please Sign up or sign in to vote.
How to do TDD/BDD with Visual Studio Express editions


This article will show you how you can do TDD/BDD with Visual Studio Express editions. While most people say it is not possible, it is actually pretty easy.


How Do You Do It ?

  1. Open your project in Visual Studio Express
  2. Add a new class project, name it [Project].Specs
  3. Add a reference to the testlib you want to use with Nuget (Right click on the project references and choose "Manage Nuget Packages") - I use MSpec a lot.
  4. Start AutoTest.Net, after you configured it for the testlib (adjust AutoTest.config file for the correct testrunner)
  5. Start writing your specs
  6. Every time you save a file, your project is compiled and your tests are run

That is all you need; pretty simple actually, is it not?

There is also the possibility to have notifications and stuff like that, but I currently do not use them.

But Wait, What If I Need to Debug a Test?

As I sometimes only do integration tests, I need the ability to debug these tests. But there is no option to do this in the Express editions, or is there?

Well, this took me a bit longer to find out, but once you know how to do this, it is pretty easy:

  1. Right click on your spec project, and choose "Unload project"
  2. Right click the unloaded project and choose "edit [xxx].Specs.csproj", you will see an XML
  3. Find the matching PropertyGroup for your configuration (usually <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">)?
  4. Add the following child items in the property group (I used mspec as an example here):
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  5. Save and close the .csproj file
  6. Right click on the project and reload it
  7. Set a breakpoint in the test you want to debug
  8. Right click again on the project, and.....
  9. ... you can now choose "Debug this project" !!!

Final Words

While this approach takes a few minutes to setup, it is definitely not that hard to do. In fact, I just copy the test EXEs and settings over from another project whenever I need to do it a second time on the same machine. At least this approach will allow you to do proper TDD/BDD with the Express editions of Visual Studio.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Tom Janssens
Founder Virtual Sales Lab
Belgium Belgium

You may also be interested in...


Comments and Discussions

QuestionIs this any use for unmanaged C++? Pin
Stefan_Lang9-Nov-11 22:39
memberStefan_Lang9-Nov-11 22:39 
AnswerRe: Is this any use for unmanaged C++? Pin
Tom Janssens9-Nov-11 23:22
memberTom Janssens9-Nov-11 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171016.2 | Last Updated 10 Nov 2011
Article Copyright 2011 by Tom Janssens
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid