DEV Community

Brian Anderson
Brian Anderson

Posted on

How I knockdown "Object Locator Flakiness" in automation testing.

As a Tester I have to deal with increasing new page objects and changing identifiers when the web application grows in Web UI testing. No matter if you are a manual or an automation tester, updating object locators for the Application Under Test (AUT) is a required step when changes are made. This helps ensure regression testing flows without friction, and all key functionalities are not affected.

Alt Text

Self-healing is a common solution provided by automated testing tools made to solve the challenge of constantly changing the UI of web applications. Self-healing capability offers a host of benefits for testers and their team: it takes less time and effort to ensure all the functional tests run smoothly and avoids interruption for all executions.

Self-healing Automation's definition and Its benefits

Self-healing is a mechanism made to solve the problem of identifying objects as the product evolves, and necessary changes are made. Offered by most automation frameworks in the market, Self-healing is automation for automation. Testing tools with self-healing can detect changes in the properties and automatically update with new attributes to ensure the designed test cases are functional.

In web testing, one common challenge is to deal with changes in the application under test as the product takes on another shape. Web UI testing can be considered an integral part of any web application product. It is what the users first experience, and it also reflects the quality of production for businesses. However, when the UI changes, test objects’ properties also change, causing the tests to fail later on.

When test scripts are easily affected by the rapid release and update of the product and its development team, test case maintenance becomes inevitable for testers. For both manual and automation testers, having to go back to old scripts and update new properties to each object is a daunting task, let alone the fact that Agile development is now the new norm.

The self-healing mechanism

When designing test scripts for Web UI testing, both low-code and code-driven practices, objects of the AUT are bound to a locator to run the test steps successfully. The AUT will not stay the same over time, and each tweak or change made to the UI will be mismatched with the predesigned test cases.

Alt Text

Testers usually expect their test cases to fail as updates are constantly added unless they have had plans for maintaining the test scripts despite future changes — by employing a self-healing mechanism.

Automation frameworks build the self-healing capability as a “smart” feature that makes testing easier for teams. To avoid failed test cases, the test automation tool will apply the new object’s locators and ensure the entire script stays up-to-date with each change made to the product’s design.

Why Self-healing is essential and its benefits to your team

Self-healing is the key to build an efficient maintenance process for automated testing. Without a doubt, with a well-planned out maintaining approach, testers free themselves from a heap of repeating tasks and never-ending edits in the test scripts.

Less failed test cases

Your tests might fail; that’s no news to any tester, however, sometimes the root cause of failures is simply that the UI changed and the test did not. With self-healing activated, tests are most likely to not fail due to the inability to detect the correct locator of the object — disrupting the flow of the whole project.

Prevent object locator flakiness

Flakiness in testing makes it hard for testers to identify whether or not their tests are stable. “NoSuchElementException” is one of the many errors that cause flakiness to the test design that Testers cannot have much control over. By ensuring the test’s design stays updated with the app, executions flow more easily, seamlessly, with less tendency to fail when it is unable to detect the object. (Find out more)

Save time and effort of maintaining test scripts

Failed test results prevent testers from gaining valuable insights on their tests, because the root causes may vary and do not reflect the real status and performance of the AUT.

Another important aspect of testing is to anticipate the users’ behavior and build a product that is ready for the unexpected. This does not sound simple; well, it truly is not. Self-healing takes away their concern for each time the UI gets updated: regression test cases have a high chance to fail, and eventually slow down the entire development flow.

Apply Self-healing using Katalon Studio

Prior to Katalon Studio version 7.6, users are familiar with the Auto-healing Smart XPath plugin provided by the Katalon team. The plugin is made to recover the broken default locators for testing in batch overnight.

As a successor, the new Self-healing capability of Katalon Studio is an upgrade of the same principle, only better.

See the full tutorial for self-healing

And other automation tools

Smartbear, another company also provides testing tools to have self-healing feature. So I think you could check it out from here.

Alt Text

Or with Testsigma, an AI-driven Test Automation tool they have UI Identifier to correct Object Locator Flakiness automatically. You can check out their blog at (

Alt Text

Top comments (0)