top of page

Self Healing Test Automation Best Practices

Self Healing Automation Next Big theme for Automation after Selenium Success

At Next Generation Automation, Team always look forward next 5 years to understand where demand is coming for Automation and Self healing test automation is one such area which stands strong compare to other themes.

Today when Next Generation Automation team talk to clients having outsourcing business more than 10 Million + USD, every client says my automation stack very good but when my development team release more complex features automation stands weak and resulting huge effort of my QAs in maintaining the automation stack and in some scenarios I found test scripts no longer applicable as entire business work flow gets changed due to complex business environment where we need to operate to satisfy our customer demands.

And Recently when Next Generation Automation Team present deck how Self healing automation can be solution for client complex testing needs, every client got excited and agreed to start POC by Next Generation Automation Academy experts.

In this article, We like to share some of best practices that can be used for Self healing Automation and help testing vendors to chase new area of automation where still lot of potential available for growth in next 5 years.

Lets start first understand what is Self Heal Automation?

We start with real life Scenario and take an example of human body created by almighty God. As soon any human get injured, self healing mechanism automatically gets trigger and start working to heal wounds. Depending on intensity of wounds, this healing may take some time longer than anticipated and medical procedure also plays important role in healing quickly than natural process of heal. If human body don't have feature of self healing, it will be very difficult for human body to recover from any accidents or diseases.

Same way today's automation also needs self healing. Most of automation frameworks which exist currently in market more towards building some what similar to human body as analogy but very few frameworks enable recovery scenarios in form of healing that determine what needs to be done if there is significant change in application flows. And all this makes scripts start failing though application functional right.

When we introduce self healing mechanism in automation stack, scripts adapt as per change in business work flows. And this result in less maintenance effort by QA and also more stable test execution and also helps discover more application defects.

3 Principles to know before you apply Self Healing Automation in your projects:

Get to know your application.

This is the most important principle. It's easy to dive in and start automating self-healing mechanisms, but you'll waste time if you don't understand the production problems your application is having before you begin. First, set up automated alerts to see which error scenarios are most common.

Prevention is better than cure.

Sure, it's nice to be able to recover from error test scenarios automatically, but it's better to prevent the error test scenarios wherever possible. Take a holistic look at test problems you detect so that you can identify and fix the root causes where possible. This can be done with more test reviews, fixing test scripts maximum for any changes in application.

Happier Automation Teams

A primary goal of self-healing systems should be happier automation teams. Self-healing systems bring not only benefits to developers and operations. But an often-overlooked benefit is that an test script that fixes itself reduces the support burden on the automation team. Less rote and menial work means happier automation engineers.

How to pattern your self-healing test automation

1. Error handling

The first pattern to look at is error handling. The idea is simple enough: spot an error and adjust how the system responds accordingly.

You've probably been using this pattern for a long time. A familiar example is catching an exception and returning a test failure. You can use this same pattern to implement something a bit more sophisticated

More practical scenario can be as soon as error got occured and exception handling code start execute apply different behaviours for different error scenarios like if error due to Object Repository scan the application and buld Object repository again using web scalping and find if new Object repository can solve the error or not.

2. Manage the flow of information

The second pattern concerns managing the flow of test information, which is also probably something you're already doing. For example, when an exception is thrown in your test script, you probably catch it and log useful information to your test logs before allowing the exception to propagate across different reports and systems.

More effectively you let your error conditions flows in your testing life cycle, more effectively self healing algorithms can be applied.

3. Adjust problematic data

Major test scripts fail as data no longer support the test flows and trigger false alarms. Data self healing mechanisms also need to be applied other than fixing test scripts alone.

Example can be as soon as data alarm gets generated by the test script look for ways to refresh test data from different up stream channels feeding data into your application and make sure every column data gets checked with set of data checks before feeding same data to test your application.

4. Retry

As applications move towards micro services architecture, any module gets interacted with multiple modules same time and synchronization between modules sometimes not at required levels which makes your test scripts to start failing.

Example you perform payment at your web page but payment gateway takes time which sometimes very huge and sometimes very less to respond for successful payment id and your test script gets failed. As retry mechanism gets checked into your test scripts it becomes easier to let such business scenarios gets executed by re run your test scripts multiple times.

Nutshell, Keep it simple with automation

Self-healing systems are not about machine learning or artificial intelligence, but about understanding your systems' frequent error scenarios and automating simple recovery steps.

By keeping these four simple patterns in mind, you'll be able to find creative ways to make your test scripts more robust by automating solutions to those cumbersome application issues that keep cropping up.

Building better QA for tomorrow


bottom of page