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

时间:2013-05-20 15:33:30

标签: visual-studio-2010 visual-studio visual-studio-2012 coded-ui-tests

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

using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;

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

enter image description here

即使有了这个红色,我也可以在本地构建和运行,但是如果可能的话,我想让这些东西得到解决。我的构建计算机拒绝此错误:

 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?)

任何提示?我的测试项目中的所有引用都设置为复制local = true。

更新 - 我通过添加对visualStudio.TestTools.UITesting的引用来使本地工作在本地工作,但CodedUITest属性仍为红色,并且构建仍然失败且具有相同的错误。

4 个答案:

答案 0 :(得分:7)

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

答案 1 :(得分:7)

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

enter image description here

答案 2 :(得分:2)

在VS2017中,我不得不使用Visual Studio安装程序来安装"编码的UI测试"构建服务器上的组件。它出现在"个人组件" "调试和测试"下的选项卡部分。

答案 3 :(得分:0)

我有一个类似的问题,但就我而言,我想使用一个称为CodedUIDependencies的NuGet,而VS一直尝试使用Program Files中的dll。我终于发现该项目在.csproj中有一个设置,迫使它使用这些文件。

<IsCodedUITest>True</IsCodedUITest>

通过将其更改为False,我可以重新安装Nuget,VS最终将引用所需的dll。