An addin that allows you to run and debug NUnit projects within Visual Studio without setting a start program in the debug options or attaching manually to an external process.
How does it work?
After installing the plugin you'll find a new submenu under the tools menu.
It currently contains only three entries:
This will open the settings dialog, which allows you to specify the location of the NUnit-GUI and NUnit-Console.
This will start the GUI version of NUnit and attaches the debugger to it.
This will start the console version of NUnit and attaches the debugger to it.
If there are changes in the code the addin will compile the new assembly before starting NUnit.
The addin will try to locate the NUnit binaries on the fly but you can always specify the location in the settings dialog.
Keyboard shortcuts can be set under Tools -> Options -> Environment -> Keyboard.
The addin has been tested under Visual Studio 2005 and 2008 under XP and Vista.
On project I'm currently working on we're using NUnit on the buildserver and MSTest/NUnit combo on the workstations. Since our test projects are MSTest projects we can't specify an alternate startup program to debug NUnit and even if we could it
wouldn't help very much because every workstation installation differs in the location and version of NUnit. This addin will either locate NUnit automatically or a user can specify the location, which allows us to use both MSTest and NUnit within Visual
When working with NUnit test projects there are a few integration solutions which allows you to run and debug your tests from within Visual Studio:
- Install the TestDriven.Net/Resharper.
Altho both are great addins, they don't come for free.
Promising addin package that can be found here on Codeplex. Sadly the release seems to be far from stable at the moment (but keep an eye on them).
- Point the startup program to nunit-console.exe under the debug project properties and give it the $(TargetPath) argument.
This will allow you to set the test project as the start project and will automatically attach the debugger to the nunit-console.exe process.
There is however one big disadvantage: the path to nunit-console cannot be relative so unless all your colleagues/co-developers have the same installation location and version of nunit this will not work. Altho the startup program isn't saved in the project
file itself (it's stored in the user options), setting the startup program every time for each project can be tedious.
Another issue is that you can't use this when combining MSTest projects with NUnit since you cannot specify an alternate startup program.
- Start the nunit gui, open the test project, alt-tab back to Visual Studio, set a break point, select debug -> attach to process, search for the nunit process, attach to it, alt tab back to nunit gui and start the test.
Well ... it works.
- Instead of making a class library project make it an executable that does the same thing as nunit-console.exe.
This is actually a pretty good workable solution. The only thing you'll need is a reference to the console runner and since the path to a reference can be relative you can include the assembly in the solution and every co-developer can execute the test
no matter if he/she installed NUnit or has a different version.
However; combining this with MSTest is a nono since MSTest projects can only be class libraries.