Visual Studio Options for TDD revisited

So I previously mention a neat way to set up visual studio to work with a console test runner so you don't switch to the error list all the time. There is a potential problem here. Sometimes you add a compilation error to the code. In this case the post build step will still be executed with the old binary and since we don't switch to the error list and just look at the output window we might miss the compilation errors. This is not a good thing...

The solution is however pretty easy. In your assembly with all your tests you have a post-build step to run the test runner. What you need to do is to add a pre-build step to your production assembly, i.e. the assembly you're testing looking like this: del $(TargetPath)

This way, if there is a compilation error in your production code you'll get an error when you try to run the tests since the production assembly will be deleted for sure.

Comments (0)

Skip to main content