简体   繁体   中英

Running multiple NUnit Projects in Visual Studio

I have a solution that has multiple projects including NUnit Test projects. 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.

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'). 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). 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).

Any suggestions on improving this would be appreciated. Running NUnit 2.5.9 and 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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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