在 Visual Studio 2013 测试代理上使用 Shims 运行测试 [英] Running a test using Shims on a Visual Studio 2013 Test Agent

查看:43
本文介绍了在 Visual Studio 2013 测试代理上使用 Shims 运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在许多网站上发现了这个问题的各种迭代,但是到目前为止,我还没有找到任何提供完整答案的内容.我刚刚设置了一些 Visual Studio 测试代理,它们似乎都在运行并运行我们最初计划在它们上运行的大部分单元测试.但是,当我开始检查其中一个单元测试时,它在线上失败了:
使用 (ShimsContext.Create()),

使用堆栈跟踪:
<代码>结果信息:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException:无法从 COR_PROFILER_PATH 和 COR_PROFILER 环境变量解析探查器路径.
阅读了其他一些帖子后,我在测试代理上安装了 Visual Studio 2013 并确认它可以在本地运行测试.然后我将 COR_PROFILER_PATH 设置为我的机器上正在使用的分析器,该分析器安装在:C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll".然后它在与跟踪相同的地方失败:
<代码>测试方法抛出异常:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException:无法获取探查器模块句柄 'C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\12.0.0\Microsoft.IntelliTrace.Profiler.12.0.0.dll'.找不到指定的模块 ---> System.ComponentModel.Win32Exception: 找不到指定的模块

建议是探查器已在单独的进程下加载,无法使用.有没有人在这个或类似的设置上取得过任何成功?在基本层面上,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:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.
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:
Test method threw exception:
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

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?
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 运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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