Completed
Last Updated: 17 Dec 2013 21:01 by ADMIN
ADMIN
Cody
Created on: 27 Mar 2013 19:29
Type: Feature Request
0
Need smarter XAML Find Expression recording
When recording Silverlight applications Test Studio needs to be smarter about what it records as the target element and the properties. For example, if you click on a TextBox Test Studio will record clicking on a Grid element which is contained underneath the main TextBox element. While technically the Grid element maybe topmost, it is very brittle and does not line up with how you build XAML applications.

It's brittle because Test Studio records a XamlPath for locating the Grid element. It ignored the AutomationID that is applied to the TextBox element the Grid is contained under. It would have been much smarter, more reliable, to record clicking on the TextBox element that has the AutomationID instead.

It also is confusing to a XAML developer. When you create your XAML file, you don't put a Grid element in your XAML. You put a TextBox in your XAML and apply an AutomationID property to that element. It's the Silverlight engine that is adding the Grid element underneath at runtime. Test Studio should be smart and recognize TextBox as "the lowest element" and target that instead of the automatically inserted Grid element.

Another way Test Studio is not very smart is building chained find expressions (find element A then underneath that find element B). It seems to always want to use a brittle XamlPath for element B. In one specific case there are two TextBox's that have the same AutomationID. One is located in the main display, the other is located in a popup child window. If you specifically target the TextBox contained in the popup child window, Test Studio records a find expression as find the child window having AutomationID X then use a brittle XamlPath to find element B. If instead it recognized that the AutomationID is unique within the context of the child window and record that AutomationID instead the test would be far more resiliant to UI changes in the application.
2 comments
ADMIN
Pavel
Posted on: 01 Aug 2013 12:47
We cannot resolve this as we don't have repro steps for the described problems.
ADMIN
Konstantin Petkov
Posted on: 12 Apr 2013 07:50
Test Studio doesn't build the visual tree, it just lets you browse it. Test Studio also records the action against the element the user clicks on and it could be any element in the visual tree. It shouldn't matter which element is that as long as TS is able to locate that during playback.

Grid is a layout element in XAML and is often seen as a sub element in the tree for even simple controls in Silverlight and WPF. 
http://msdn.microsoft.com/en-us/library/system.windows.controls.grid.aspx
Also keep in mind in XAML one can build whatever elements tree they need, search the web for "Lookless" in XAML.
A XAML developer should be aware of the technology specifics and this part of the feedback is not related to Test Studio in any way.

I see two separate issues leading to actionable items out of this mixed feedback. The first issue is about the generated find expression in specific case with extended TextBox control for the particular customer application. The second issue is about building the chained find expressions which may not be good enough in case of similar popups containing elements with the same Automation ID. The first is a problem, the second - a feature request.

Please let me know if I'm missing something out!