Simple rules for enabling au

Best practices, code snippets for common functionality, examples, and guidelines.
gvrachliotis
Posts: 8
Joined: Wed Aug 31, 2016 8:29 am

Simple rules for enabling au

Post by gvrachliotis » Mon Mar 06, 2017 3:42 pm

One common situation in almost every ranorex project I have worked with is automation not working after a few new software releases, because e.g. a menu button changed position or order etc. I mainly write automated test cases for Web UIs and web apps. When creating my repository I always try to track items with a combination of attributes that are unlikely to change e.g. name or id html attributes, but in many cases attributes like these do not exist. If you could present developers a list with best practices to introduce in their code, which will enable automation testing for the long run, what would you include in the list, e.g. id attribute in all html tags? Thanks.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Simple rules for enabling au

Post by odklizec » Wed Mar 15, 2017 8:59 am

Hi,

Well, I'm afraid, there is no, and never will be a perfect solution of this problem. We will always have to update our tests from time to time.

Basically, your developers should not forget to add unique IDs or at least reasonable "accessible name" strings to the critical GUI elements.

At your side, you should avoid using element indexes at any cost! These are least stable attributes and should not be used, unless there is absolutely no other way. Instead of using element indexes, try to reference the elements using neighboring/parent elements (labels, cells, etc). Eventually, in case of tables, which typically don't have IDs for individual cells, use childindexes, obtained from table header columns.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration