NUnit Test Adapter for Visual Studio 11
The NUnit Test Adapter allows you to run NUnit tests inside Visual Studio. The current release, version 0.94, is designed to work with Studio 2012 RTM or Update 1. Some features are not available under the RTM.
Note that Releases of Visual Studio prior to VS 2012 did not have the ability to directly run tests built with Open Source testing frameworks like NUnit.
Installation
The easiest way to install the NUnit Test Adapter is using the Extension Manager within Visual Studio. Follow these steps:
- From within Visual Studio 2012, select Tools | Extension Manager.
- In the left panel of the Extension Manager, select Online Extensions.
- Locate the NUnit Test Adapter in the center panel and highlight it.
- Click 'Download' and follow the instructions.
Use the Extension Manager to ensure that the NUnit Test Adapter is enabled.
Usage
In preparation for using the test adapter, make sure that the Unit Test Explorer is shown in your window. If you don't see it, use the menu ( Test | Windows | Test Explorer ) to show it and position the window where you would like it within Visual Studio.
When you initially open a solution, no tests will be displayed. After compiling the assemblies in the solution, Visual Studio will interact with the NUnit Test Adapter to discover tests and a list of them will be shown in the Test Explorer.
Click on Run All in the Test Explorer to run all the tests. You may also select one or more tests in the list and run them by right-clicking and using the context menu. The context menu also contains entries for debugging tests and for navigating to the source code of a test.
Tests may be grouped by Duration and Outcome under VS2012 RTM and also by Traits and Project using Update 1. NUnit translates any Categories and Properties used on your tests to Visual Studio as Traits.
Tests may be filtered under Update 1 by Trait, Project, Error Message, File Path, Fully Qualified Name, Output and Outcome. Use the search edit box at the top of the list of tests to specify a filter.
Known Problems
There is no test status in Visual Studio corresponding to NUnit's Inconclusive result, so tests with this result are reported as Not Run. Click on the individual test to see the result.
Grouping by fixture is not yet available.in Visual Studio.
Theories are reported as individual cases, rather as a single unit.
Startup performance is substantially improved but is still slower than using NUnit directly.
Reporting Problems
Bugs should be reported using the separate test adapter bug tracker on Launchpad.