Using NUnit in Visual Studio 2010

Like in older versions of Visual Studio it is possible to use NUnit as an external tool in the new 2010 version. By creating a toolbar as well it is very easy to run your test suite. The usual way to add an external command is by clicking the menu Tools -> External Tools. However, by default this menu item is not visible. To enable this menu item go to Tools -> Settings -> Expert Settings.

Visual Studio 2010

The first step is download and install the latest version of NUnit since older versions are not compatible with .NET 4. NUnit version 2.5.5 can be downloaded here.

Now go to Tools -> External Tools:

Visual Studio 2010 External Tools

I think this screen shot explains itself very well. Now its possible to add this external command to a tool bar. To do so go to View -> Toolbars -> Customize:

Visual Studio 2010 Customize Toolbars

Press the New button and enter a name. Now open the Commands tab and add the external command (usually External Command 1 when you don’t have any other external commands) to the toolbar:

Visual Studio 2010 Toolbars

When clicking the NUnit button in the new toolbar the NUnit GUI starts and loads your test suite.

14 thoughts on “Using NUnit in Visual Studio 2010

  1. Great tip. I will clarify that last step about selecting the “External Command [x]” . The [x] corresponds to entry number of “Nunit tools” in the “External Tools” window. For example if Nunit tools is the third entry in the list, then you would select “External Command 3”

  2. Nice tutorial, altough I am still trying to find a way to run the external tool for a project that has the binary output set to another folder, not the default /bin/debug.
    I tryied with the Initial Directory set to $(SolutionDir)\MyActualBinaryFolder but NUnit says the file was not found. Do you have any tip about how I could resolve this?

    Thanks in advance.

  3. Hi Ulysses Alves,
    It should be indeed something like you said, try to verify all the arguments and try to run NUnit manually with these arguments. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *