如何在visual studio 2010中运行Nunit测试 [英] How to run a Nunit Test inside visual studio 2010

查看:135
本文介绍了如何在visual studio 2010中运行Nunit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用nuget包管理器添加Nuint

添加类libriary并编写测试方法



在visual studio 2010中



现在我将如何运行此测试?

Hi,

I add Nuint using nuget package manager
Add class libriary and write test method

in visual studio 2010

Now How I will able to run this test ?

推荐答案

适用于Visual Studio的NUnit 3.0测试适配器



NUnit 3.0测试适配器允许您在Visual Studio中运行NUnit 3.0测试。这是一个新的适配器,部分基于原始NUnit测试适配器的代码,但已修改为与NUnit 3.0一起使用。



无法运行NUnit 2 .x测试使用此适配器。为此目的使用原始适配器。如果您需要使用NUnit 2.x和其他使用NUnit 3.0的项目处理项目,您可以安装适配器的两个版本。



NUnitLite Runner



要在NUnitLite下运行测试,请按以下步骤操作:



1.创建一个控制台应用程序,用作测试程序集。如果您已经在dll中放置了测试,则可以更改项目以便生成控制台应用程序并重新加载它。

2.确保测试程序集同时引用nunit.framework和nunitlite。 br />
3.控制台应用程序的Main()看起来应该是这样的......

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.

NUnitLite Runner

To run tests under NUnitLite, proceed as follows:

1. Create a console application to use as your test assembly. If you have already placed tests in a dll, you can change the project so that it produces a console application and reload it.
2. Make sure your test assembly references both nunit.framework and nunitlite.
3. The Main() for your console application should look something like this...
public static void Main(string[] args)
{
  new AutoRun().Execute(args);
}



4.执行测试应用程序以运行测试。


4. Execute your test application in order to run the tests.


这篇关于如何在visual studio 2010中运行Nunit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆