Skip to content
CharliePoole edited this page Apr 6, 2015 · 10 revisions

###NUnit 3.0 Test Adapter for Visual Studio

The NUnit 3.0 Test Adapter allows you to run NUnit 3.0 tests inside Visual Studio. This is a new adapter, based partly on the code of the original NUnit Test Adapter, but modified to work with NUnit 3.0.

It is not possible to run NUnit 2.x tests using this adapter. Use the original adapter for that purpose. If you need to work with projects using NUnit 2.x and other projects using NUnit 3.0, you may install both versions of the adapter.

The current 3.0 Beta release is designed to work with Visual Studio 2012, 2013 and 2015. Some features are not available under VS2012 RTM.

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.

####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, and Class using Update 2. NUnit translates any Categories and Properties used on your tests to Visual Studio as Traits.

Tests may be filtered in Visual Studio 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.

Tests may be organized by play lists in Visual Studio under Update 2. Playlists are more or less equal to the old test lists from VS 2010.

Parameterized tests will show up as separate test cases for each set of parameters.

####Known Problems

  1. 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.

  2. Grouping by fixture is not yet available.in Visual Studio.

  3. Theories are reported as individual cases, rather as a single unit.

  4. Startup performance is substantially improved but is still slower than using NUnit directly.

  5. A NuGet package is not yet available.

####Further information

For more information see the blogs by Charlie Poole and Terje Sandstrom

The MSDN ALM blog post series on How to Manage Unit Tests in Visual Studio 2012 Update 1 is useful for later versions as well:

####Reporting Problems

Bugs should be reported using the issue tracker on Github.

Clone this wiki locally