Stop procrastinating...download TestDriven.NET already!
I've written about this add-in before, but I frequently run into .NET developers who are attempting test driven development without using the free TestDriven.NET Visual Studio .NET add-in.
I've basically always used TestDriven.NET (formerly NUnitAddin) to do unit testing within VS.NET so I wonder, do most developers try to switch between VS.NET and the NUnit GUI to run the tests occasionally? I dislike context switches like that. To debug, wouldn't you have to attach the debugger to the NUnit GUI process? Yikes. Anything that adds extra steps into the edit-compile-debug cycle is just friction.
Here are two observations:
- Optional things that add friction to the development cycle are eventually going to be skipped.
- Unit tests don't do any good if they aren't run.
Save yourself some time and don't bother writing the tests in the first place if you aren't going to run them regularly. Ideally with every build, but that's a different topic.
With the TestDriven.NET add-in you just code up a test like you always did (we use NUnit), right click on the test method right there in your code editor and select Run Test. The tests are run and results reported right there in your Visual Studio output window. If you have a failed assertion, double click it in the output window and it takes you right to that line in the test. Can you get any less friction than that?
If you want to run all of the tests in the namespace, right click on the namespace, if you want to run all of the tests in a project, right click on the project in solution explorer. If you want to step through your test in the debugger, right click and select Test With Debugger. That's about all you need to know about it...it just works.
Do yourself a favor and download this free tool if you haven't already.