views:

323

answers:

3

I am using Visual Studio 2008 standard editing for my personal projects. This edition does not support unit testing out of the box. I have some experience with the test possibilities in Visual Studio Team System.

What (free) options do I have if I want to do unit testing? Is it possible to open the test projects made with Microsoft test by others?

A: 

TestDriven.net is pretty good and I think there's a free version available here

zebrabox
+4  A: 

I am using NUnit with Visual Studio 2008. In the past I have also used it with Visual Studio 2005.

It works great.

For running it I use a project where the unit tests are defined, separate from the main project. For interactive use I then set this project to the default project (right-click on project/Set as Startup Project) and set Properties/Debug/"Start external program" in this project to something like

C:\Program Files\NUnit\bin\nunit-x86.exe

In the same screen "Start Options/Command line arguments" is set to something like

..\..\..\temp2\MSQlib1,2008-03-14a.nunit"\MSQlib1,2008-03-14a.nunit

This points to the NUnit project file ("MSQlib1,2008-03-14a.nunit" in this example)- the ".."s are due to being relative to the bin\Debug folder where the DLL for the project is located (the application is this case is the NUnit GUI application) and which will be the current directory when debugging is started.

The result is that the NUnit GUI application is started when F5 is pressed in Visual Studio and calls back into the application when the unit tests are run from the NUnit GUI application.

This allows breakpoints to be set in the unit tests (if needed). E.g. to get information on why a unit test failed by doing inspection with the debugger. In my case this has sometimes been necessary when the mass of elements carbon, hydrogen, nitrogen, oxygen and sulphur were changed slightly and masses of amino acids no longer were within limits.

Peter Mortensen
+1  A: 

The most used ones out there are probably NUnit and XUnit. I'm not sure how TestDriven.NET supports XUnit, but with NUnit you can run a single test, a class its tests or all test with a click of the mouse or keyboard shortcut. TestDriven.NET is a VS2005/2008 plugin which also allows super fast testing, especially when using TDD. The NUnit UI app isn't really usefull for that I think.

I did use NUnit and still want to give XUnit a test drive, but for work I mostly use MSTest (what comes with Visual Studio)

Dennis van der Stelt