Test maintenance. No-one likes it. Yet it hangs there, on every team’s to-do list month-in, month-out, eating away at your junior engineers’ will to live (and their coffee supplies).
You don’t have to live like this any more.
Thanks to developments in AI testing tech, self-healing test automation is more accessible, easier to implement, and significantly more reliable than ever before. No complex tinkering with Selenium libraries required, and no more so-called ‘smart’ waits that are not actually smart.
Here’s a complete guide for those new to self-healing tests, and for those coming back to it now the technology’s got good.
Self-healing test automation is a set of techniques and tooling that:
A self-healing test automation tool will try to repair the test using a variety of techniques and continue to run the test, rather than providing a ‘fail’ result. Modern test automation tools log what changed and present suggested fixes that engineers can review and accept.
Increasingly, yes. Previously, teams have gotten away without it because a) the technology around it was patchy, and b) tech team release schedules, workloads, and budgets looked pretty different pre 2020.
Modern software evolves quickly. User data has never been more plentiful. You’d be foolish not to use that data to make regular improvements to your app – especially given how crowded the market is out there.
Lots more releases = lots more tests. You’ll need your testing suite to grow with you, whilst minimizing time spent on routine maintenance. With tighter budgets, fewer personnel, and the disappearance of separate QA teams, software teams need to release more frequently with significantly fewer resources than the 2010-2020 boom.
Automation and AI have to bear some of that burden to maintain software quality. Given how much time teams spend on test maintenance, self-healing tests are the natural place to start.
There are a number of approaches to healing tests without manual input. Typically, automated testing tools will use a combination of:
The rise of AI-led automated testing tools has made self-healing tests faster and more accessible, thanks to a range of low/no code features, and tools that get smarter the more you test.
Different AI tools use different self-healing techniques. To give you an example of how it all works, let’s take a quick peek under Momentic’s hood:
Intent-based natural language locators
Rather than relying purely on hardcoded CSS selectors or XPaths, Momentic lets you describe what you want (in terms as simple as ‘Click the Submit button’), then uses AI to map intent to the correct UI element.
AI-enhanced element detection
If the original element can’t be found because its ID or class changed, Momentic tries to locate a replacement using other attributes, including visual cues, accessibility data, and position in the DOM – our selectors adapt as your UI changes.
Smart waiting & stabilization
Momentic waits for the page to stabilize (DOM events, network idle) to reduce timing issues and flakiness.
Failure recovery (auto-patching steps)
When a test step fails, Momentic’s engine can propose one or more step changes to continue the test run, then allow human review for acceptance.
Learn more about Momentic’s self-healing test automation
Other than all those hours saved manually fixing flaky tests, you mean?
Time saved on manual test maintenance is a huge reason to implement self-healing test automation (think of all the development work you could get done in that time!), but it isn’t the only benefit. You’ll also get:
Self-healing tests are a great tool for testing most features – but there are a couple of areas where you might want to hang back, or use a different testing method.
For example, you might want more human input when testing security-sensitive flows where a false click could have significant consequences, such as banking transactions. And, where you want to assert an exact UI layout or copy, you’ll be better off using visual regression tests.
Where self-healing tests are a good fit, there are a few common pitfalls you’ll want to avoid to keep your test suite as healthy as possible:
There are a few options out there. Use this table to find the right one for you!
An e-commerce team refactors their CSS and several button class names change. Traditional tests that used .btn-checkout fail. A self-healing tool tries a list of fallbacks: matching by visible text (‘Checkout’), ARIA labels, and relative position to the cart summary.
The healing system finds the button via text match, clicks it, and logs a suggested fix (‘replace the brittle class selector with an attribute or test ID’). The run completes and the team reviews the suggestion in the next sprint.
A complex SPA generates dynamic element IDs on every load. Tests that relied on those IDs break intermittently. The self-healing automation tool detects instability in ID usage and starts using stable attributes (data-test-id) or combines role and text heuristics. Over time, the test suite learns which attributes are stable and auto-updates the locator registry.
A mobile app’s login button changes position between small and large devices. Visual recognition (or ML-based matching) locates the button based on shape and label rather than absolute coordinates. If visual recognition is unsure, a fallback finds the “Login” text field and then the associated button nearby.
Imagine how much more efficient your release schedule would be if your tests maintained themselves.
Just ask the team at Retool, who have 4x’ed their released cadence and saved over 40 engineering hours per month with Momentic. Pretty handy for a tool used by anyone who’s anyone in the Fortune 500.
Want to join them? Book a demo today to see how Momentic could take your test speed and coverage stratospheric.