问题描述
我在许多网站上发现了这个问题的各种迭代,但是到目前为止,我还没有找到任何提供完整答案的内容.我刚刚设置了一些 Visual Studio 测试代理,它们似乎都在运行并运行我们最初计划在它们上运行的大部分单元测试.但是,当我开始检查其中一个单元测试时,它在线上失败了:使用 (ShimsContext.Create())
,
使用堆栈跟踪:
建议是探查器已在单独的进程下加载,无法使用.有没有人在这个或类似的设置上取得过任何成功?在基本层面上,Visual Studio 测试代理可以使用 Fakes 运行测试吗?
谢谢
I have found various iterations of this question across a number of websites, however so far I have not found anything that provides a full answer that worked.I have just set up a number of Visual Studio Test Agents that all appear to be behaving and running most of the unit tests we are planning on initially running on them. However when I came to checking one of the unit tests it is failing on the line:using (ShimsContext.Create())
,
With the stack trace:Result Message:
Having read some other posts I installed Visual Studio 2013 on the test agent and confirmed it would run the test locally. I then set COR_PROFILER_PATH to the profiler that was being used on my machine which was installed at: "C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll".It then failed in the same place with the trace:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.Test method threw exception:
The suggestion is the profiler has been loaded under a separate process and can't be used. Has anyone had any success with this or similar set ups? At a fundamental level can Visual Studio Test Agents run tests with Fakes?
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to get profiler module handle 'C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll'. The specified module could not be found ---> System.ComponentModel.Win32Exception: The specified module could not be found
Thanks
推荐答案
我知道这有点旧,所以 OP 可能得到了他的答案,但对于其他任何人,我就这个问题向 Microsoft 开了一张票,然后一个半小时后,我们针对此问题查看了我的设置后得出的答案:
I know this is a bit old, so the OP probably got his answer, but for anyone else, I opened a ticket with Microsoft on this issue, and the answer we came to after an hour and a half of looking at my setup for this problem:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException:无法从 COR_PROFILER_PATH 和 COR_PROFILER 环境变量解析探查器路径.
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
,我使用的是 mstest.exe 我应该一直使用 vstest.console.exe.就我而言,这是因为我现在的代码中有 Fakes 测试.
, was that I was using mstest.exe and I should have been using vstest.console.exe. In my case it was because I have Fakes test in my code now.
我使用的是 Visual Studio 2013 更新 4.
I'm using Visual Studio 2013 update 4.
这篇关于在 Visual Studio 2013 测试代理上使用 Shims 运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!