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

为君一笑 提交于 2019-12-08 09:52:47

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/20951804/how-to-make-an-nunit-testproject-use-its-own-config-when-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!