I love the recent progress in AI and its application in test automation. As a tech nerd and computer science graduate it’s fascinating (it’s a techy thing). But I’ve also had 20 odd years experience implementing test automation solutions and bear the battle scars. So let’s ground ourselves a little.

Are we gravitating to technology for technology’s sake? Are we just being lazy and undisciplined, do we really need AI to mop up after us?

Let me explain: If I’m listening correctly, we are on the verge of “Intelligent Selectors”, basically a tech that will revolutionize the way that we teach our automated tests how to find the application elements we want to interact with.

This is one of the cornerstones of Automated Testing, how we teach our automation tools to recognize the UI elements we want to interact with, repeatedly and reliably.

Remember GUI Maps? (WinRunner), Object Repositories? (UFT), and more recently Selenium Selectors? (those By.x clauses)? Point to or Inspect a field, button or UI component and define the attributes that we think will be a reliable way to identify that element repeatably and we are good.

BUT This is a key area of brittleness and constant failure in automated tests. XPath is the biggest offender, it defines how to locate an element by virtue of its place in an application structure, say the relationship with its parents and so on up the hierarchy to the root of the application. E.g.

/html/body/div/div/table/tbody/tr[2]/td[2]/p

The brittleness in this strategy is easy to see, if we remove any component in the element’s parent chain (for example a decorative container, e.g. one of the divs) the test will fail.

In marches AI! Which through Machine Learning and some cool tech will give you a 90.1% chance of finding the element by more abstract descriptions e.g. “The Login Button”.

Sounds cool. But… come on folks, isn’t there a more obvious way of solving this?

Communication. That’s it really, get your Devs and Test Engineers to talk!!

If Devs put a reliable means of identifying unique elements, say adding an id attribute on every application element then we wouldn’t need sophisticated AI to find them for us, a simple By.Id in Selenium would do. And it’s free! Lastly, set up a culture that means If the Devs don’t do it, raise a defect!

Am I missing something here?

Ref: https://www.linkedin.com/pulse/come-devs-build-us-automatable-apps-yes-we-eat-our-own-brigginshaw/