Coded UI tests - cannot resolve symbol UITesting
Asked Answered
F

4

8

I'm trying to use the assemblies like this in a VS2012 project:

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

However I get a bunch of red in my tests:

enter image description here

I can build and run locally even with this red, but I'd like to get this stuff resolving if possible. My build machine rejects this with the following errors:

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

Any tips? All references in my test project are set to copy local = true.

UPDATE - I got the references working locally by adding a reference to visualStudio.TestTools.UITesting, but the CodedUITest attribute is still red and the build still fails with the same errors.

Fuchs answered 20/5, 2013 at 15:33 Comment(1)
Are you using VS2012 Ultimate or VS2012 Premium? Coded UI only runs on these to IDEs.Amato
L
8

You need to add references such as in the following attachment:

enter image description here

Leopoldoleor answered 27/2, 2014 at 7:49 Comment(1)
I needed to add all the references identified here so this is useful information. ThanksRendition
N
7

You need to add a reference to: Microsoft.VisualStudio.QualityTools.CodedUITestFramework

Neutretto answered 2/7, 2013 at 8:5 Comment(1)
Exactly what I was looking for, the namespace on the attribute is misleading :)Tsushima
A
5

In VS2017 I had to use the Visual Studio Installer to install the "Coded UI Test" component on my build server. It is found on the "Individual Components" tab under the "Debugging and Testing" section.

Aker answered 22/8, 2017 at 18:15 Comment(1)
Thanks - I was getting this error from ReSharper's command line code inspection tool, which runs on our build agent. I guess developer machines have this installed but the build agent doesn't.Applicable
Z
0

I had a similar problem but in my case I wanted to use a NuGet called CodedUIDependencies and VS kept trying to use the dlls from Program Files. I finally figured out that the project had a setting in the .csproj that was forcing it to use these files.

<IsCodedUITest>True</IsCodedUITest>

By changing this to False I could reinstall my Nuget and VS would finally reference the desired dlls.

Zimbabwe answered 27/8, 2020 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.