First, the pop up where you specify how Test Studio will locate a control, I will refer to as the "Find Element Window."
On this pop up, “Find Element Window”, you said the following:
When you are using only the "XamlTag is exactly textblock" criteria, Test Studio will find the first text block available in the Visual Tree(the one with text "John"). In order to find the third TextBlock you need to add a second criteria that is specific for the TextBlock you are looking for. For example you can use TagIndex or XamlPath.
On the left side of the “Find Element Window”, there is a suggestions tab. This tab has the properties you are referring too: TagIndex and XamlPath. Thus, the properties have values to look for. However, the suggested values are for a different textbox. How would the user/ tester know what values the correct control should have?
Note the XamlPath is based on an automationId. Again, the test user would probably need to look at the xaml of the Silverlight application to know the automationId, or name property of the control.
On the left side of the “Find Element Window”, is also a DOM tab. This tab allows the test user to find the control. However, with a complex page, it will be difficult unless you can search for the control based on the automationId or name property. But, in order to do this, the tester would need access to the Silverlight xaml. Once you find the control in the DOM, you can right click and select replace element and the find criteria seems to be correctly set.
Are you recommending that the person writing the Test Studio automation script also have access to the Silverlight xaml? (It seems like the only way to know the name of the controls.) Our application is complex with many views and it may be difficult for a tester to read and navigate throughout the solution.
Using the “Find Element Window” so far has been extremely frustrating and troublesome. My find criteria that works looks like the following:
AutomationId is exactly lblResultEntered
XamlTag is exactly label
Then I save the find criteria, and customize the test step in code.
Assert.IsTrue(Pages.PracticeTextBox.SilverlightApp.HelloAmritTextblock0.Text == "Hello, Telerik!!");
One effective way to do the validation, is to just create a coded step or customize the step in code and write something like the following:
FrameworkElement myElement = Pages.PracticeTextBox.SilverlightApp.Find.ByExpression(new XamlFindExpression("Name=lblResultEntered"));
Assert.IsTrue(myElement.Text == "Hello, Telerik!!");
The only problem with Find.ByName or Find.ByExpression is that the tester would need to know the Name property or the AutomationId of the control. What is the best approach for doing this? Should the entire Silverlight solution be given to the tester in order to determine the name properties? Is there a better way?