This is a migrated thread and some comments may be shown as answers.

Test tied up to Controlls' names

2 Answers 49 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Olena
Top achievements
Rank 1
Olena asked on 23 Feb 2011, 09:51 PM
Hi

I hope you can help me with a following problem:

When I record a test and press a button(1) or enter the text into textbox(2) inside the silverlight application WebUI records the following
1. Click BtnNewItemButton1
2. Type 'SomeText' into TxtNameTextbox3

As you can see it records the names of the elements(controlls) that were randomly given to controls during build. So later, if for any reason new element of the same type is added to the application window(tab) the test fails or executes wrong, cause what used to be BtnNewItemButton1 is now BtnNewItemButton3 and therefore can't be found/detected.

I am wondering if there is a possibility to somehow make the names of the controls stable(we are using Telerik controls in development)
Or maybe there is a possibility to tie the test to some other anchors on the application page?

Thanks a lot in advance!
Helen

2 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 23 Feb 2011, 11:13 PM
Hello Olena,

In order to make tests work most reliably despite changes to the UI ask your software developers to use the AutomationID property. This ID needs to be manually added by your developers to the .XAML source code. Each AutomationID must be unique.

When you record a test and the element has an AutomationID we will pick up on that ID and use it in our find expression for locating the correct element at run time, no matter where it got moved to in the UI. This makes the test run very reliably during the application development life cycle.

Regards,
Cody
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Cody
Telerik team
answered on 23 Feb 2011, 11:14 PM
Hi Olena,

I forgot to mention the AutomationID property is documented on MSDN here.

Regards,
Cody
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
General Discussions
Asked by
Olena
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or