Do you know how to run nUnit tests from within Visual Studio?
Last updated by Brady Stroud [SSW] 7 months ago.See history This rule has been archived
Archived Reason: This applies to old versions of Visual Studio as the test frameworks now provide their own test runner implementations for Visual Studio
Option 1: External tool (not recommended)
Using NUnit with Visual Studio: To make it easy to use, you need to add it as an external tool in Visual Studio.
In Visual Studio:
- Go to Tools > External Tools
- Click "Add" button
- Type in:
- Title: NUnit GUI
- Command: Location of nUnit.exe file
- Argument: /run (so that the tests run automatically when started)
- Initial Directory: $(Target directory)
Option 2: Test Driven .net
TestDriven.net has better NUnit integration – from both code and Solution Explorer windows.
To run unit testing: Tools > NUnit GUI to launch NUnit and run the tests.
Option 3: Other Tools
Other Visual Studio tools including Resharper and Coderush have their own integration with NUnit. If you’re already using one of these, installing TestDriven.net is unnecessary.