In order to do Coded UI tests in Silverlight 5 you need to use update the Coded UI automation helper from here: Visual Studio Gallery: UI Test Plugin for Silverlight The old one that ships with VS2010 works but only on SL4 and bellow.
SL5 was implemented a tad bit differently and it broke the Coded UI tests, therefore prompting devs to switch to VS2012 and the new UI Automation Plugin (as you have discovered).
Once you install the the UITestPluginForSilverlight.msi executable, you need to reference those assemblies in the Silverlight portion of your project (which you already have).
As far as I remember, and the reason why your Coded UI Tests broke in VS2010 but work in VS2012 is because the SL5 and SL4 UIMap.designer.cs files that are generated by the test recorders are not much compatible with each other.
SL4 recordings Generated with SL4 automation helper will not work with SL5 version of the AutiomationHelper. However SL5 Autiomation Helper will work with SL4 recordings if those recordings are generated by VS2012.
So to elaborate: When you use the recorder, it creates a UIMap file. The map file has three portions to it:
- XML Listing of all the recorded methods
- Designer Generated Code Behind partial class.
- A user partial class.
If you inspect the designer generated code behind file, you can actually figure out that the recorder generates a whole lot of code to find the controls and interact with them.
For each control the recorder discovers it declares an instance of the corresponding test/interaction object.
When declaring those objects the recorder defines a bunch of discoverable/searchable properties. The next time the playback executes it takes these properties and uses them to find the actual control.
Also, all controls have a parent, so the recorder mandatory specifies a parent UI element for each discovered control. For SL4 and SL5 the parents are as follows:
- Browser Window
- HTML Page
- Div (holding the silverlight runtime)
- SL Object (SL Runtime plugin)
- Main SL UI Element (usually the squigly buzy indicator)
- Navigation Frames
- Internal Pages
- Controls
Constructor:
- Parent Control/Interaction Object
Search Properties:
- Page Title: The total string that is rendered by the browser's window title.
- Instance Number: (starts from 1 for lists... which is weird)
- Control Id: (defined by the Name or x:Name xaml attributes)
- Display Name: This is iffy for combo box/list elements as it works
by combining whatever is rendered in the combo box/list element item combined with the instance number of that item: for example:
A combo box with two items, each named "List Item" may be discovered by the following display names:
"List Item : 1" and "List Item : 2"
- Any combination and permutation of search attributes (you can look them up).
So long story short, the actual interaction objects generated by the recorders are different in SL4 and SL5. Meaning you can't take one UIMap.designer.cs and swap it with another. The test framework (and it's associated interaction objects used in the UIMap.designer.cs) are not binary compatible. That's why your playback can't work.