Kjartan
Kjartan

Reputation: 19111

How to make an NUnit TestProject use its own config when run?

Is it possible to let Resharper (or NUnit?) know that I want each test to look for an App.config under it's own project, even when running all tests in a solution together?

Background:

I'm using NUnit and the test-runner that ships with Resharper, and I've got several test-projects in the same solution. Some of my tests depend on config-files located under their respective projects.

When I run a test-project by itself, it will use it's internal App.config, and everything works fine. When I try to run all the tests in the solution, or use the shortcut to run all tests in current test session however, no config-file will be selected, and any test depending on a config will fail by default.

For this reason, I typically end up running all tests in the solution once first, then right clicking the nodes in the test-runner for each of the config-dependent projects, and running them separately afterwards.

Upvotes: 1

Views: 296

Answers (1)

Kjartan
Kjartan

Reputation: 19111

Solved:

Apparently assemblies containing NUnit-tests can be run in separate processes or domains using command line options.

For the testrunner under Resharper, this setting can be found under Resharper > Options > Unit Testing.

There is an option "Use separate AppDomain for each assempbly with tests". Checking that solved my problem.

enter image description here

Upvotes: 1

Related Questions