由于AppDomain的项目之间穿越通过时运行ReSharper的8 NUnit的测试失败 [英] Running NUnit through Resharper 8 tests fail when crossing between projects due to AppDomain
问题描述
我最近升级到ReSharper的8,当我试图运行一套项目。这些测试包含的集成测试都使用IISExpress运行一个网站,使Web请求,并检查响应两套房。
I recently updated to Resharper 8, and when I tried to run a suite of projects. These tests contain two suites of integration tests that both use IISExpress to run a website, make web requests and check the responses.
在孤立地运行它们是成功的,并且运行的所有该测试将以前成功。然而,upate之后的第二组测试运行将失败。
Running them in isolation is successful, and running all the tests would previously succeed. However, after the upate the second set of tests to run would fail.
调查揭示了 AppDomain.CurrentDomain.BaseDirectory
下榻的第一个测试运行,而不是改变。由于集成测试是由两个项目,这是造成第二个项目失败,因为它无法找到任何所需要的配置文件。
Investigation has revealed the AppDomain.CurrentDomain.BaseDirectory
is staying as the first test to run instead of changing. Since the integration tests are composed of two projects, this is causing the second project to fail since it cannot find any of the configuration files needed.
我找不到任何选项禁用ReSharper的8本不同的行为,这似乎是在 /域的行为:单
NUnit的标志。短降级到ReSharper的7,没有任何人知道一个解决的办法?而且它是ReSharper的8或错误的预期行为。
I cannot find any option to disable this different behaviour in Resharper 8, which appears to be the behaviour of the /domain:Single
nunit flag. Short of downgrading to Resharper 7, does anybody know a solution to this? And is it an intended behaviour of Resharper 8 or a bug?
推荐答案
的变通方法:
你有没有在Visual Studio中试图去ReSharper的 - >选项 - >工具 - >单元测试
Have you tried in Visual Studio going to ReSharper -> Options -> Tools -> Unit Testing
更改设置并行运行长达1集到一个更高的数字。我试图为每个测试项目。马克斯是核心数量,我想。
Change the setting "Run up to 1 assemblies in parallel" to a higher number. I tried one for each test project. Max is number of cores, I think.
反直觉我知道,但它为我工作,我在测试失败使用AppDomain.CurrentDomain.BaseDirectory
Counterintuitive I know, but it worked for me and I am using AppDomain.CurrentDomain.BaseDirectory in the failing tests
的原因
在一ReSharper的优化缓存错误8.工作目录未正确设置。并行或许运行会为每个测试一个单独的进程,所以他们不会在彼此的设置跳闸。
The Cause A caching optimization bug in ReSharper 8. Working Directory is not set properly. Perhaps running in parallel creates a separate process for each test, so they don't trip over each other's settings.
的修复
JetBrains公司声称,这将是固定在8.0.1版
The Fix JetBrains claim that this will be fixed in version 8.0.1
的 更新:有一个新的单元测试选项加入 ReSharper的8.1 ,以适应这种情况。发现它在ReSharper的 - >选项 - >工具 - >单元测试 - >使用单独的AppDomain每个组装与测试的
Update: There is a new unit testing option added in Resharper 8.1 to accomodate this scenario. Find it at ReSharper -> Options -> Tools -> Unit Testing -> "Use Separate AppDomain for each assembly with tests.
这篇关于由于AppDomain的项目之间穿越通过时运行ReSharper的8 NUnit的测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!