Test Automation
February 6, 2024

Sahi Pro's Take on AI and Test Automation

Areas where AI could be used in functional UI test automation

There are a few areas where AI could be used in functional UI test automation:

1) Identification of elements

2) Auto-healing of automation scripts when identifiers change

3) Authoring of test cases

4) Analysis of test reports

1) AI in Identification of elements

UI automation has often been termed flaky. The main culprit here has been free tools like Selenium which are popular but solve the problem in inefficient ways. Selenium uses brittle identifiers like XPaths etc. to identify elements. Due to its popularity automation engineers believe there is no other way to identify elements and believe AI may be their saviour. Contrary to their belief, tools like Sahi Pro use fairly stable accessors which rely on various attributes of the object being identified. Sahi Pro does it not only on Web applications but also for Windows Desktop, Java, Mobile and SAP applications. AI is NOT needed in 95% of the cases in object identification. In some rare cases, Sahi Pro's AI Assist Add-on uses AI methods like Image Recognition and Optical Character Recognition (OCR). These are the exception rather than the rule and they help bridge gaps in an end to end workflow.

2) AI in Auto-healing

Selenium is again the culprit here. When a UI changes, most identifiers based on XPaths get changed. Hence, the need for constant maintenance of such automation scripts. Normally in tools like Sahi Pro, object identification does not change unless the actual element has been changed in some significant way. Sahi Pro has its own auto-healing mechanism too. However, our customers report that it is better a script fails at the element itself, rather than have it auto-healed and causing some other error later. So 2 points: a) Autohealing does not need AI b) Autohealing is unnecessary in most cases

3) AI in Authoring of test cases

When we played around, our impression is that, GenAI tools can help discover what could be typical tests for some scenario, but the actual authoring and specification of the test case needs to come from someone who owns, understands and can course-correct the test where needed. So AI is just a helper to the tester. As a helper, GenAI does help in considering a lot of cases which a less experienced tester may not have thought about.

4) AI in test report analysis

This is a simple case of good logging and inference surfacing. In Sahi Pro we log all the function calls and steps being performed, along with the data. The analysis is a simple case of looking through the stack trace of errors and pinpointing to the exact step in a function. So 20 scripts may have failed, but 14 of them are all due to the "click login button" step in the "login" function. So Sahi Pro's suite analysis would bunch up all the 14 scripts and trace the error to the login step and display it in an easily understandable way. No AI is normally needed for this type of analysis. We have heard of cases of AI to surface correlations between checkins, log errors in production and test automation scripts, but have not seen a real world implementation.

So if you are looking to slap AI over Selenium to get automation, you are going to move from an unmanageable mess to an expensive unmanageable mess. Just choose simpler, better tools like Sahi Pro which can solve automation problems in simpler, scalable, cost-effective ways.

Continue reading

Tip of the Day 10

A Usual Day at the Office