c# - Microsoft.VisualStudio.TestTools.UITesting,版本=14.0.0.0

标签 c# testing visual-studio-2015 automated-tests coded-ui-tests

我们最近从 Visual Studio 2013 切换到 2015,Microsoft 测试管理器也是如此。
我创建 CodedUI 测试的方式与我在 VS2013 中创建它的方式相同。将它与测试用例相关联,然后尝试从 Microsoft 测试管理器将其作为自动化测试运行。不幸的是我不断收到这个错误:

Error adding test case [16730] to test run: Unable to load the test container '\NAS\UTV\TFS2012\NOO\Automated Tests\Automated Tests\Automated Tests_20160310.5\testcodedui.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

这可能是由于 VS2015 中自动化测试的变化(没有测试 Controller 等)。

是否可以将 Test Controller 和 Test Agent 2013 与 VS 和 MTM 2015 一起使用?有人知道这个的解决方案吗?

最佳答案

通常,您的 2013 测试代理随附用于编码 UI 2013 (V12) 的库,当您创建测试时,Visual Studio 会自动添加这些引用。

在您的情况下,您有 2015 VSTS,因此 2015 (V14) 的编码 UI 引用将在您的测试中。但是,当您运行测试时,您的 2013 代理将无法找到您在测试中的引用。要解决此问题,您需要删除所有默认添加的编码 UI 引用并添加您自己的。

  1. 记下测试中的所有 Refrenced dll,并记下它们所在的位置。
  2. 在您的解决方案下创建一个 lib 文件夹并将所有引用的 dll 复制到该文件夹​​并将它们添加到解决方案(注意不是引用只是添加它们)
  3. Coded UI 中有几个隐式引用(您的引用的引用)您可以从 this link 中识别它们

  4. 也将它们添加到您的 lib 文件夹中。

  5. 选择您的 .csproj 文件 ==> 右键单击​​ ==> 卸载项目
  6. 再次右键单击 ==> 编辑 .csproj 文件
  7. 查看是否有导入 Testtools.target 模板的导入语句并对其进行注释。引用将是这样的 "Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets"Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')""
  8. 关闭您的项目并重新加载它。
  9. 添加对您在项目的 lib 文件夹下添加的所有 dll 的引用。
  10. 编译并确保您没有发现任何构建错误。

在此之后,关联您的测试,希望它应该运行。如果您仍然收到任何丢失文件错误,那么您缺少隐式引用。只需在 2015 VSTS 的程序文件目录中搜索并通过 lib 文件夹添加到项目引用中。它应该工作!!

关于c# - Microsoft.VisualStudio.TestTools.UITesting,版本=14.0.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36015349/

相关文章:

c# - 如何在 C# 中对 Lucene.net 中的结果进行排序?

android - 用通用的东西替换 WCHAR 和 wchar_t

testing - 在 Lotus Notes 8.5 上自动测试

Typescript 测试绝对导入检查问题

java - 如何避免 BeanCreationException : Could not autowire field error

asp.net-mvc - 无法从 VS 2015 中的 Controller 添加 View : "There was an error running the selected code generator"

c# - 启用 native 代码调试以深入 COM 对象

c# - 防止 Windows 服务管理器停止服务 c#

c# - 增加 OLE DB 连接字符串中的连接池大小

c# - 是否有命令将 nuget.exe 指向特定的 NuGet.Config 文件?