Forum Discussion

Mario_Alberts's avatar
Mario_Alberts
New Contributor
15 years ago

Create Automated Tests that are Resistant to Changes in the UI

Object 1 was changed to Object 2 and my script fails now.   The article below describes this scenario; how do I provide unique names so that my script will always run?


1). Aliases.MyApplication.frmCustomerLookup.grpPhoneSearch.pbPhoneNumber.RegExTextBox


2).Aliases.MyApplication.wndWindowsForms10Window8app033c0d9d.WindowsForms10Window8app033c0d9d.Item.Item2


"Automated tests created with scripts or keyword tests are dependent on the application under test. The user interface of the application may change between builds, especially in the early stages. These changes may affect the test results, or your automated tests may no longer work with future versions of the application. The problem is automated testing tools use a series of properties to identify and locate an object. Sometimes a testing tool relies on location coordinates to find the object. For instance, if the control caption or its location has changed, the automated test will no longer be able to find the object when it runs and will fail. To run the automated test successfully, you may need to replace old names with new ones in the entire project, before running the test against the new version of the application. However, if you provide unique names for your controls, it makes your automated tests resistant to these UI changes and ensures that your automated tests work without having to make changes to the test itself. This also eliminates the automated testing tool from relying on location coordinates to find the control, which is less stable and breaks easily."

17 Replies