如何使NUnit的TestProject的使用其自己的配置在运行时? [英] How to make an NUnit TestProject use its own config when run?

查看:164
本文介绍了如何使NUnit的TestProject的使用其自己的配置在运行时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能让ReSharper的(或NUnit的?)知道,我想每一个测试,以寻找一个的App.config 在它自己的项目,运行所有测试,即使在溶液一起?

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?

背景:

我使用NUnit和测试亚军附带ReSharper的,和我有几个测试项目相同的解决方案。我的一些测试依赖于位于各自项目下的配置文件的地方。

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.

当我单独运行一个测试项目,将使用它的内部的App.config ,和一切工作正常。当我尝试运行解决方案中的所有测试,或者使用快捷键运行在当前的测试环节中的所有测试但是,没有配置文件将被选中,任何测试取决于配置将被默认失败。

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.

由于这个原因,我通常最终会运行所有测试溶液中的一次,再右键单击在测试亚军节点为每个配置相关的项目,并分别运行它们之后。

Due to this, 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.

推荐答案

解决:

显然组件包含NUnit的检验可以在单独的进程中运行或使用命令行选项域的。

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

有关ReSharper的下的TestRunner,这个设置可以在发现ReSharper的>选项​​>单元测试

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

有一个选项的使用单独的AppDomain每个assempbly与试验的。检查解决我的问题。

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

这篇关于如何使NUnit的TestProject的使用其自己的配置在运行时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆