Serendipity running machine progressing toward accomplishments.

Run NUnit for the current VisualStudio project

On a lot of projects, I use NUnit for unit testing, usually I create a separate project that contains only the tests.

There tools that integrate fully with the Visual Studio, like ReSharper or TestDriven.NET, but they cost money, and more importantly – you can’t run them on Express editions.

So I’ve made this useful shortcut to easily run it for the current (test) project. Screenshots are made on Microsoft Visual Studio 2010 Professional running on Windows 7.

I have added the that “NUnit” item in the External Tools section – it’s pretty easy to do.

Click on the “External Tools…” item to bring up the dialog, then click “Add”.

I have used just NUnit as the title, but you could put anything.

The full command looks like this:

C:\Program Files (x86)\NUnit 2.5.5\bin\net-2.0\nunit.exe

The arguments are:

$(ProjectDir)$(ProjectFileName)

That’s it – now you can easily run the tests from the Visual Studio without opening NUnit and hunting down the test project.

Bojan Bjelić

I'm a software architect, blogging about software, productivity and digital world.

More Posts - Website - Twitter



Leave a Reply

Note that I moderate all comments, so this may not appear immediately. I reserve the right to not publish comments that I consider aggressive, off-topic, or that don't contribute directly to the discussion. I will not publish anonymous posts, or comments where you didn't provide a real email address. I may contact you by email before publishing.