简体   繁体   English

在Visual Studio中运行多个NUnit项目

[英]Running multiple NUnit Projects in Visual Studio

I have a solution that has multiple projects including NUnit Test projects. 我有一个包含多个项目的解决方案,其中包括NUnit Test项目。 So the solution looks like this (using generic names, these aren't the actual names): 因此,解决方案如下所示(使用通用名称,这些不是实际名称):

+ Solution
  + Project1
  + Project1.Test
  + Project2
  + Project2.Test
  + Project3
  + Project3.Test
  ...

I would like to run all the NUnit Tests through the NUnit GUI or console application when I click 'Start Debugging' from within Visual Studio. 当我从Visual Studio中单击“开始调试”时,我想通过NUnit GUI或控制台应用程序运行所有NUnit测试。

Right now, what I have done is added a new Class library called TestRunner and set it to be the StartUp project (I've read I don't really need to do this, I can just right click on the project and click 'Debug > Start new instance'). 现在,我所做的就是添加了一个名为TestRunner的新类库,并将其设置为StartUp项目(我读过,我并不需要这样做,我可以右键单击该项目,然后单击“ Debug” >启动新实例”)。 Then inside the project properties on the Debug page, I set the 'Start Action' to 'Start external program' and select the nunit-console.exe (Looks like nunit.exe GUI doesnt support multiple assemblies as input parameters). 然后,在“调试”页面上的项目属性中,将“启动操作”设置为“启动外部程序”,然后选择nunit-console.exe(看起来像nunit.exe GUI并不支持多个程序集作为输入参数)。 Then in the 'Command line arguments' I enter the path to each of the projects. 然后在“命令行参数”中输入每个项目的路径。 Like this: 像这样:

设定

This seems to work OK, but I'm wondering if there is a better way to do this (maybe I don't need an extra project, or there might be an easier way to run multiple NUnit Test projects from within Visual Studio). 这似乎可以正常工作,但是我想知道是否有更好的方法可以做到这一点(也许我不需要额外的项目,或者可能有更简单的方法可以从Visual Studio中运行多个NUnit Test项目)。

Any suggestions on improving this would be appreciated. 任何改进的建议将不胜感激。 Running NUnit 2.5.9 and Visual Studio 2008. 运行NUnit 2.5.9和Visual Studio 2008。

There are various test runner extensions for Visual Studio itself - personally I use ReSharper (commercial) and also NCrunch (used to be free, now commercial), although the latter is more of a continuous test tool than a "run explicitly" tool. Visual Studio本身有各种测试运行程序扩展-我个人使用ReSharper (商业)和NCrunch (以前是免费的,现在是商业的),尽管后者更像是一个连续的测试工具,而不是“显式运行”工具。 If you're using Visual Studio non-Express, you should really look at running tests integrated into the IDE - it's much, much nicer than switching between apps. 如果你正在使用Visual Studio的非明确,你应该看一下运行集成到IDE测试-这是多少,比应用程序之间切换更漂亮。

However, if you want to run the NUnit GUI, just set up an NUnit project configuration which includes all your test projects - you'll only need to do that once, then you can use it however you run the tests. 但是,如果要运行NUnit GUI,只需设置一个包含所有测试项目的NUnit项目配置-您只需要执行一次,然后就可以使用它,而无需运行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM