Self-healing test automation adapts to changes using intelligent algorithms, dynamic element identification, and machine learning. It autonomously adjusts tests, predicts failures, and ensures stability, reducing manual intervention and enhancing reliability in dynamic environments.
Designing IA for AI - Information Architecture Conference 2024
Building Resilient Software A Deep Dive into Self-Healing Test Automation Frameworks
1. Building Resilient
Software: A Deep Dive
into Self-Healing Test
Automation Frameworks
Ritika Gupta
Automation Consultant
(Test Automation Competency)
2. Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Join the session 5 minutes prior to the session start time. We start on
time and conclude on time!
Feedback
Make sure to submit a constructive feedback for all sessions as it is very
helpful for the presenter.
Silent Mode
Keep your mobile devices in silent mode, feel free to move out of session
in case you need to attend an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during the session.
3. 1. Introduction
2. The Problem: Fragile Test Automation
3. The Solution: Introducing Self-Healing Automation
4. Benefits of Self-Healing Test Automation
5. Real Life Comparison
6. How Does Self-Healing Work?
7. Self-Healing Process
8. Some Popular Self-Healing Test
Automation Frameworks/Tool
9. How to Choose Best Self-Healing Automation Framework
10. Examples of Self-Healing
11. Demo
6. Traditional test automation relies on
specific UI element identifiers (IDs, names,
XPaths).
Changes to the AUT, even minor UI
adjustments, can break these identifiers.
Broken tests lead to wasted time,
frustration, and unreliable test results.
The Problem : Fragile Test Automation
8. Self-healing automation is a technique that
enables test scripts to adapt to changes in the
AUT.
When a test fails due to a missing element, the
self-healing mechanism kicks in.
The tool attempts to identify the element using
alternative attributes or relative positioning.
For example: self-healing mechanism of human
body.
The Solution: Introducing Self-Healing Automation
10. Reduced test maintenance time: Less time is spent
fixing broken tests due to UI changes.
Improved test suite reliability: Tests are more resilient
to AUT modifications, leading to more reliable results.
Increased test automation ROI: More time can be
dedicated to creating new tests and improving test
coverage.
Enhanced tester productivity: Testers can focus on
higher-level test strategy and analysis.
Benefits of Self-Healing Test Automation
14. Test executes as usual, interacting with the AUT.
During element identification, if the primary locator
fails, the self-healing mechanism activates.
The tool employs various strategies to locate the
element using alternative attributes or relative
positioning.
If a suitable element is found, the test continues
execution.
If healing fails, the test is marked as failed, but the
potential new locator can be logged for review.
How Does Self-Healing Work?
18. Healenium – Selenium based self-healing testing
framework extension/plugin
Functionize - AI powered automated web application
testing tools for complex applications.
Testrigor - Codeless automation tools, empowered
by the latest AI-driven technologies.
Some Popular Self-Healing Test Automation Frameworks/Tool
20. Open-Source vs. Commercial
Maturity and Adoption
Focus on AI/ML
Integration with Existing Tools
Determine Your Application
Preventive Actions
How to Choose Best Self-Healing Automation Framework
In today's world of fast-paced software development, maintaining reliable and efficient automated tests can be a challenge. Traditional test automation often becomes brittle due to frequent changes in the application under test (AUT). This presentation will introduce you to the concept of self-healing automation tests, a revolutionary approach that helps overcome these challenges and ensures the continued validity of your automated test suite.
Many testers have experienced the pain of maintaining a large suite of automated tests. Traditional test scripts often rely on specific identifiers to locate elements on the Application Under Tests(AUT's) user interface (UI). Even minor UI changes, such as a button name modification or a layout adjustment, can break these identifiers, causing tests to fail. This fragility leads to wasted time spent fixing scripts, frustration for testers, and ultimately, unreliable test results.
Self-healing automation offers a powerful solution to the challenge of fragile tests. This approach equips test scripts with the ability to adapt to changes in the Applications Under Test(AUT). When a test fails due to a missing element, the self-healing mechanism springs into action. The tool employs various techniques, such as searching for elements with alternative attributes or using their relative position to other stable elements on the page. This allows the test to continue execution and potentially even fix itself.
This is exaclty like the human body created by almighty God. As soon as any human gets injured, a self-healing mechanism automatically triggers and starts working to heal wounds. If the human body doesn't have the feature of self-healing, it will be very difficult for it to recover from any accidents or diseases. The same way, When we introduce self-healing mechanisms in the automation stack, scripts adapt as per changes in business work flows. And this results in less maintenance effort by QA, more stable test execution, and also helps discover more application defects.
Self-healing automation offers a plethora of benefits for testers and development teams alike.
By enabling tests to adapt to changes, self-healing significantly reduces the time and effort required to maintain test scripts. Before an application is released to the public, it has to be tested several times to make sure it performs as advertised. Retesting is needed whenever these applications receive updates or modifications. This process can take a long time, especially if the software is to be tested on multiple hardware.
Self-healing automation significantly speeds up the testing process and reduces test maintenance time. Routine tests and debugging become a breeze since self-healing testing algorithms can determine repetitive activities quickly. In just a few hours, self-healing can finish the testing process. This is a huge improvement compared to the days or weeks needed by standard test automation or human testers.
This translates to a more reliable test suite that is less prone to failures due to UI modifications. Imagine the time saved and the peace of mind gained by knowing your automated tests can adapt to the inevitable changes in your application. Software performance is not static. Applications need constant maintenance and testing to ensure optimum functionality. However, traditional modes of testing are not foolproof, and errors do arise. An example is the infamous “NoSuchElementException” error that prolongs the testing process and puts doubt on the reliability of the test design.
Self-healing testing helps by improving the accuracy and reliability of the testing process. It allows the development team to run a small test base and accurately isolate the stable tests from the glitchy ones. AI and machine learning likewise ensure consistent output delivery, enhancing the overall reliability of the testing process.
This translates to Reduced Manual Effort and Cost, therefore, higher return on investment (ROI) for test automation, as more time can be spent on creating new tests and improving overall test coverage. Unstable software test methods can make developers lose confidence in automated tests and resort to manual testing. This manual method of software management is tedious and tiring, which negatively impacts the team’s productivity. They are unable to give due attention to app feature validation since they are bogged down by these tests.
A self-healing test will lighten the team’s load and reduce the amount of manual effort required for test maintenance. The costs will be mitigated since less manpower and computing resources need to be allocated to software testing.
Moreover, Self-healing test automation gives testers and developers better insight into how the software works and helps them identify issues early on. Self-healing testing can speed up the development process and reduce your expenses.
Self-healing test automation also gives development teams a firmer grasp of several aspects of component and software performance. This allows them to create best practices that they can incorporate into future applications.
So let's now see these benefits into action, by seeing a simple real-life comparison of traditional test automation and self-healing test automation set-up.
When a script breaks, manual object identification maintenance can take up to 15 minutes per occurrence. A script breaks when object properties change, and an automation engineer must stop developing new scripts to troubleshoot and fix the broken one. The team manually inspects or spies the object to see the new property value or find new properties to use, then updates the script or object repository accordingly and reruns the script.
The math is daunting: One application deployment per week could encounter around 35 object changes (which varies greatly based on application maturity, development methodology, size of project, etc.). At 15 minutes per manual fix, the result is more than one person’s full workday — 8.75 hours — spent per week on basic automation maintenance.
But it doesn’t have to be that way. Self-healing automation is a solution that addresses the No. 1 cause of test automation script maintenance: object changes. The “object,” in this context, is an item in a script — such as a button or text box on a webpage — that the script (or the user) would interact with to perform tasks. Scripts must be able to uniquely identify which object it needs to perform an action on — which text box should it put your username into? Just as a person can be identified by physical attributes such as size, hair color or eye color — or by other relative means (“that person we saw at the store yesterday”) — objects must also be uniquely identified in some way. And, just as people’s appearances can change to the point that they aren’t recognizable to others, objects that no longer fit their original “description” can confuse traditional automation scripts. When that happens, scripts break and downtime accumulates.
Self-healing employs data analytics to identify objects in a script even after they have changed. The result is a system that goes far beyond the “Band-Aid” approach often written into scripts, such as the use of wildcards or regular expressions to handle variation in object names or identifiers. Rather than relying on those methods — and allowing productivity to grind to a halt anytime they fail — the self-healing approach introduces a higher level of intelligence and analysis.
When your script fails due to being unable to find the object it expected, the self-healing mechanism provides a fuller understanding and analysis of options. Rather than shutting down the process, it examines objects holistically, evaluates attributes and properties of all available objects and uses a weighted scoring system to select the one most similar to the one previously used. Self-healing can scrape, evaluate and choose among 10 objects in less than 0.05 seconds. Stopand-go syndrome is effectively cured.
Let's delve deeper into the inner workings of self-healing automation. During test execution, the script interacts with the AUT, attempting to locate elements as defined in the test case. If the primary locator (ID, name, XPath) fails to find the element, the self-healing mechanism takes over. The tool employs various strategies, such as searching for elements with similar attributes like text content, class name, or tag name. It can also try to locate the element based on its relative position to other stable elements on the page. If a suitable alternative element is found, the test continues execution, and the potentially broken locator can be flagged for review. If the healing attempt fails, the test is marked as failed, but the potential new locator information can be captured for further analysis by the tester.
The process is straightforward. When an object cannot be found (due to a property name or value change), the failed object is fetched from a historical object repository file, along with all its property names and values. All similar objects (such as all other text boxes) that do exist on the page are scraped, including all their properties and values and saved into an “Object Capture” table. Self-healing will use various similarity scoring algorithms to evaluate how similar each property is between the missing historical object and the available objects on the page. Each property is given a similarity score (while also considering customizable weightage so you could say that “name” is more useful to identify a match than “color,” for example) and ultimately each possible match is given a total score.
Self-healing will return the object and its properties with the highest score for use. The script can then attempt to identify the new object, continue on in execution and update framework repositories with the new object information, as long as everything works.
A whole lot of work..! Isn't it.. Yes explantaion of how it works took time. And if we do it manually while writing the script will result in increase of time in script completion. So to do all these steps now we have number of frameworks and tools. Let's take a look.
Healenium – Selenium based self-healing testing framework extension/plugin
Functionize - AI powered automated web application testing tools for complex applications.
Testrigor - Codeless automation tools, empowered by the latest AI-driven technologies.
While there's no single "most popular" self-healing test automation framework, here are some insights to guide your selection:
Open-Source vs. Commercial: Both options exist, with open-source frameworks offering greater access and customizability, while commercial solutions might provide more comprehensive features and support.
Maturity and Adoption: Consider how established the framework is and its user base. A larger community often signifies more resources and support available.
Focus on AI/ML: Some frameworks leverage Artificial Intelligence (AI) and Machine Learning (ML) algorithms for more sophisticated self-healing capabilities. These can intelligently identify and adapt to UI changes.
Integration with Existing Tools: Look for frameworks that integrate well with your current development and testing tools. This ensures a smooth workflow and avoids data silos.
Determine Your Application: Before putting self-healing automation into action, you first have to be familiar with your software. Specifically, you have to identify frequent errors and other factors that are hampering its development. If you’re having trouble manually locating these issues, set up an automated alert system.
Preventive Actions: Prevention is better than cure. After self-healing testing is done fixing and fine-tuning your application, take notes of the test results to avoid making the same mistakes. Moreover, use the best practices you learned, so the problems or errors don’t recur.
Remember:
Research and evaluate frameworks based on your specific needs and project requirements.
Explore free trials or demos offered by commercial solutions.
Consider the technical expertise within your team when choosing a framework's complexity.
Let’s review a few sample scenarios in different tangents, illustrating how self-healing tests can adapt to changes and “heal” themselves to provide accurate results.
Web Application Testing
Consider that a web application undergoes a redesign. Previously, a Login button had the ID btnLogin, but now, it is btnUserLogin. A traditional automated test looking for btnLogin would fail, but a self-healing test can identify that the button is functionally the same, even though the ID has changed. It adjusts its parameters to look for btnUserLogin and continues testing without human intervention.
Mobile Application Testing
Consider a mobile app where the purchase process has changed. Initially, users selected an item, entered their shipping information, and then entered their payment information. Now, they enter their payment information before their shipping details. A self-healing test suite would identify this change and rearrange the steps in its test cases to match the new process.
API Testing
During API testing, an API endpoint changes, moving from /v1/user to /v2/user. A self-healing test suite could detect the HTTP 404 errors resulting from calls to the old endpoint, recognize the new /v2/user endpoint in the updated API documentation or response headers, and update its tests to use the new endpoint.
Database Testing
Consider an example where the schema for the database changes. The email column in the users table is renamed to user_email. A self-healing test suite could read the new schema, identify the difference, and update its tests to use user_email instead of email.
So now lets take a look of how these tools or framework actually works with a small example. I have used Selenium Webdriver to showcase the example. So far I will show how manually we can work with locators that may change in future. These all steps that I will show will be taken care of by the extensions or plugins that we just discussed. It is a simple test where I am redirecting to a website and trying to enter the user name with the locator. In my case I am using the ID given.
Integrating self-healing test automation in the software testing process is beneficial and essential in today’s digital landscape. It boosts test accuracy and dependability, minimizes manual effort, and cuts operational costs to a great extent. These automation tools offer many advantages that streamline operations for software developers and business owners. As a result, high test coverage, quick feedback cycles, and improved software quality supports customer experience and business retention.
With these substantial advantages, self-healing automation testing tools propel the efficiency and effectiveness of software testing to unprecedented heights. Indisputably, self-healing automation has become a cornerstone in the software development ecosystem.