编码的UI测试 - 无法解析符号UITesting

Rob*_*ous 6 visual-studio-2010 visual-studio coded-ui-tests visual-studio-2012

我正在尝试在VS2012项目中使用这样的程序集:

using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
Run Code Online (Sandbox Code Playgroud)

但是我在测试中得到了一堆红色:

在此输入图像描述

即使使用这个红色,我也可以在本地构建和运行,但是如果可能的话,我想让这些东西解决.我的构建机器拒绝此错误,并出现以下错误:

 DashboardTest.cs (7): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 DashboardTest.cs (9): The type or namespace name 'UITest' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.cs (9): The type or namespace name 'UITest' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.cs (10): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.Designer.cs (19): The type or namespace name 'UITest' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.Designer.cs (20): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.Designer.cs (132): The type or namespace name 'BrowserWindow' could not be found (are you missing a using directive or an assembly reference?)
 DashboardTest.cs (10): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.cs (12): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.cs (13): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.Designer.cs (22): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 UIMap.Designer.cs (23): The type or namespace name 'UITesting' does not exist in the namespace 'Microsoft.VisualStudio.TestTools' (are you missing an assembly reference?)
 DashboardTest.cs (18): The type or namespace name 'CodedUITest' could not be found (are you missing a using directive or an assembly reference?)
 DashboardTest.cs (18): The type or namespace name 'CodedUITestAttribute' could not be found (are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)

有小费吗?我的测试项目中的所有引用都设置为复制local = true.

更新 - 我通过添加对visualStudio.TestTools.UITesting的引用来获取本地工作,但CodedUITest属性仍然是红色,并且构建仍然失败并出现相同的错误.

小智 7

您需要添加一个引用:Microsoft.VisualStudio.QualityTools.CodedUITestFramework

  • 正是我所寻找的,属性上的命名空间是误导:) (2认同)

Iho*_*lyk 7

您需要添加以下附件中的引用:

在此输入图像描述

  • 我需要添加此处标识的所有引用,以便这是有用的信息.谢谢 (2认同)

小智 5

在 VS2017 中,我必须使用 Visual Studio 安装程序在我的构建服务器上安装“编码的 UI 测试”组件。它可以在“调试和测试”部分下的“单个组件”选项卡中找到。