tags:

views:

310

answers:

2

I have 13 separate but related architecture assemblies, and 13 separate NUnit test assemblies, each one containing all the test fixtures for its matching architecture assembly. I am using NUnit 2.5.2 (latest version currently).

I can run each test assembly separately in the NUnit GUI and all the tests pass. However, when I come to combine them into a single NUnit project file, NUnit insists on applying a single config file to the whole test run. This won't work because each test assembly requires different config. I can't merge them into one "uber-config" file because some of the sections are mutually exclusive. I have tried running each assembly in the project in separate AppDomains, and also separate processes, but in both cases it fails to use the DLL-specific config file, so all the tests crash and burn.

I have done a Google search but so far I have not found any indication that NUnit supports this scenario. Am I right, or have I missed something?

I have tried my hardest to re-architecture the tests so that they could share the same config file, but I've had to admit defeat on that front.

+1  A: 

In the past I've done this with a batch file running each assembly through the nunit console independently. At one point I had something that merged the xml output together. It might be in the CruiseControl.Net code.

I haven't worked on the NUnit project for a while. I only have the older code in my head. But the issue is that you get one config per AppDomain and NUnit loads all the test assemblies into one AppDomain.

You might want to try alternate runners such as Resharper or TestDriven.net

Mike Two
Thanks Mike. I looked at TestDriven.NET, which led me onto MBUnit, which led me onto Gallio. I tried creating a Gallio project from the NUnit test assemblies, and all the tests executed successfully in that (once I had removed all my Setup Fixtures which Gallio refuses to run). I will probably swap between the NUnit and Gallio GUIs now, because the NUnit GUI has much better error reports.
Christian Hayter
+1  A: 

NUnit 2.5 has as setting where you can enable each assembly to run in a separate AppDomain. By doing this, NUnit will load the config for the assembly and not the one for the .nunit project.

For more info, see here:

http://nunit.org/index.php?p=settingsDialog&r=2.5

Brian Hartsock