0
votes

I'm using the ALM Rangers Coded UI Word Add-in from http://vsarcodeduiword.codeplex.com/ and I would like to be able to make assertions on the code of fields in a selection of text.

I can make assertions on the text selected, which is represented by a UITestControl object. The problem is that the properties supported by the Coded UI Word Add-in are limited. Since it's open source I tried adding support for the Fields property myself (I believe the selected text is a Word.Range object)

I added the following line of code to the GetSelectionProperty in UITestCommunicator.cs in the WordAddIn project in the add-in mentioned above: case PropertyNames.Fields: return selection.Fields;

The problem is that when I try to access that property, the test fails with the error posted below. Is there another way to add support, or

Test method CuiAutoTagTagTestProject.CuiAutoTagTagTests.InsertOutTag threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dllRunning under executable C:\Program Files\Microsoft Office\Office14\WINWORD.EXE--- A detailed error log follows. === Pre-bind state information ===LOG: User = WINDWARD\marcusjLOG: DisplayName = Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified)LOG: Appbase = file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/LOG: Initial PrivatePath = NULLCalling assembly : (Unknown).===LOG: This bind starts in default load context.LOG: No application configuration file found.LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.LOG: Post-policy reference: Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aLOG: Attempting download of new URL file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/Microsoft.VisualStudio.TestTools.UITest.Extension.DLL.LOG: Attempting download of new URL file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/Microsoft.VisualStudio.TestTools.UITest.Extension/Microsoft.VisualStudio.TestTools.UITest.Extension.DLL.LOG: Attempting download of new URL file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/Microsoft.VisualStudio.TestTools.UITest.Extension.EXE.LOG: Attempting download of new URL file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/Microsoft.VisualStudio.TestTools.UITest.Extension/Microsoft.VisualStudio.TestTools.UITest.Extension.EXE.

1

1 Answers

0
votes

Here's the problem, there is a file that wasn't copied over. file:///C:/Users/marcusj/AppData/Roaming/Microsoft Visual Studio ALM Rangers/Coded UI Word 2010 Add-in/Microsoft.VisualStudio.TestTools.UITest.Extension.DLL was missing.

So the solution: I searched C: and found it here: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies Copied it over and all is good.

Along with adding a line of code to GetSelectionProperty(WordSelectionInfo, string):

case PropertyNames.Fields: return selection.Fields;

I also added a line of code to WordPropertyProvider (WordExtension/WordPropertyProvider.cs):

map.Add(PropertyNames.Fields, new UITestPropertyDescriptor(typeof(Word.Fields), Read));

With this, everything seems to work out okay.