Run Unit Test in VS2012 with NUnit

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:

  1. From within Visual Studio 2012, select Tools | Extension Manager.
  2. In the left panel of the Extension Manager, select Online Extensions.
  3. Locate the NUnit Test Adapter in the center panel and highlight it.
  4. 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

  1. There is no test status in Visual Studio corresponding to NUnit's Inconclusive result, so tests with this result are reported asNot 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.

Reporting Problems

Bugs should be reported using the separate test adapterbug tracker on Launchpad.   


refer to: http://nunit.org/index.php?p=vsTestAdapter&r=2.6.2


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值