M365Con 2027 – free online conference · 11–22 Jan 2027 · 120 sessions→ m365con.net

Blog · Mirko Peters

Self-healing tests: what the term means and where it stops

By · · Updated

Self-healing test automation repairs broken locators at run time. Learn how it works, what it cannot fix, how it can hide bugs and which guardrails to set.

Self-healing test automation means a test tool repairs a broken locator on its own, so a UI test keeps running after a harmless change such as a renamed ID. This guide is for test automation engineers who have heard the term in a sales pitch and want a sober answer. You will learn how healing works, what it can fix, what it cannot, how it can hide a real bug, and which rules keep it safe. A worked example with made-up numbers shows both the benefit and the risk.

Key points

  • Self-healing means a test tool finds a UI element by other clues when its stored locator stops matching, so the test can continue instead of failing.
  • It works almost only on locators, not on assertions, test flows, business rules or timing problems, so it covers a narrow slice of test maintenance.
  • The main risk is a masked regression: the tool adapts to a changed element that is actually a defect, and the test passes while the user experience is broken.
  • Vendor documentation says healing happens at run time and the script stays unchanged, so healed locators still need to be reviewed and written back.
  • Safe use means logging every heal, reviewing them on a schedule, never letting the tool change assertions, and watching for sudden jumps in the pass rate.

What a self-healing test is, in practice

A UI test finds each UI element on a page with a locator. A locator is a rule such as "the element with ID btn-pay" or "the button named Pay". In traditional test automation, a person edits the test scripts whenever a rule stops matching. In a large test suite, one redesign can turn hundreds of steps red. Each time a test fails, a QA engineer has to look at it, and the team spends days on repair work or falls back on manual testing.

Self-healing is the idea that the tool repairs that rule itself, so a self-healing test survives a change that would break a traditional test. The BugBug article Self Healing Test Automation: Hype & Reality defines it as mechanisms that automatically adjust how a test identifies UI elements when the original locator stops working.

Healing does not mean the tool understands your product. It means the tool tries to find the same element again by other clues, then goes on with the run. Treat a self-healing test as a repair for one narrow kind of break: UI changes that leave the behavior the same.

How locator healing works

The details differ by test framework and product, but most self-healing mechanisms follow the same pattern.

  1. Learn. During passing test runs, the tool records more than one clue for each element. BugBug describes this as a fingerprint: attributes such as ID, text, classes, ARIA labels and position in the page structure.
  2. Detect. When the stored locator finds nothing, the tool does not fail at once.
  3. Search. It looks through the page for the element that most resembles the one it remembered. Stronger, more stable clues carry more weight, and weaker ones are a fallback.
  4. Continue and report. It uses the new match, finishes the run and logs what it did.

BrowserStack's documentation for its self-healing feature with Playwright follows the same flow. It says healing starts when the original locator no longer resolves, and that it needs at least one earlier successful run with the same element identifier. It also says healing happens at run time and keeps a single run green, while the script itself stays unchanged. The page advises pushing the healed locator back into your test. It lists limits as well: healing adds extra analysis during a run, the Playwright support is described as limited, and it cannot recover when the element truly no longer exists.

Some newer tools use AI self-healing: a model, often built on generative AI, chooses the replacement element instead of a fixed scoring rule. The T-Plan guide points out that AI-assisted healing introduces probabilistic behaviour into testing and that reliable automation should stay deterministic wherever possible. BugBug adds that healing does not involve an AI agent rewriting test logic or a real understanding of the application.

Marketing often says that AI testing does the healing. In practice, AI in software testing covers a wide range, from simple similarity scoring to a model that ranks candidate elements. Ask a vendor what the AI actually decides, and whether the log shows why. If the AI picks a wrong element, a defect can slip through, so an AI choice needs the same review as any other heal.

Benefits of self-healing, and what it cannot fix

Healing helps most with cosmetic churn:

  • A developer renames an ID or a CSS class, and behavior stays the same.
  • A layout shift moves a button to another place.
  • A component library upgrade changes the markup but not the screen.

In these cases the benefits are real: less test maintenance, and harmless UI changes no longer fail many test cases at once.

The self-healing capabilities of a tool fit into a wider test automation strategy, next to exploratory testing, for continuous testing. They protect test coverage of the user interface against UI churn. Unit tests and API testing do not use screen locators, so they need no healing at all.

It does not help with most of the other reasons tests fail. BugBug states that healing applies almost exclusively to locators, not to assertions, expected values, test flows or business rules. It does not solve timing issues or poor test architecture. If your problem is unstable waits or shared data, treat flaky tests as a separate topic first, because healing will not cure them. The same article says healing struggles in role-based systems, dynamic dashboards, multi-step transactions and heavily conditional screens, and that the more context is needed to identify an element, the harder healing becomes.

Good locators and stable test IDs also prevent many breaks before any healing is needed. Playwright's best practices suggest locators that reflect what users see, such as role and text, instead of fragile CSS or XPath paths. This advice helps in Selenium suites too.

Self-healing test automation and the risk of masked regressions

The most important risk is simple to state. A self-healing tool that adapts can adapt to a defect.

The T-Plan guide on self-healing test automation names it a masked regression: a framework may automatically adapt to a changed element that actually represents a defect, so the test passes even though the user experience is degraded. It adds that this creates false confidence and reduces trust in automation. It also notes that self-healing systems may pick the wrong replacement element, that the more aggressive the healing, the higher the risk of wrong matching, and that some failures should stay visible.

Think of a Save button in the application under test that is replaced by a Delete button in the same place after a faulty merge. A test that looks for "the button in the form footer" may heal onto the new button, click it and carry on. The suite stays green, and the bug ships.

This is why a rising pass rate is not always good news. If your pass rate jumps after a UI release with no matching test changes, check the healing log before you celebrate.

Guardrails that make it safe to use

The T-Plan and BugBug guides give similar advice. It applies whether you implement self-healing yourself or buy a self-healing tool:

  1. Log every heal. Record the old locator, the new locator, the matching confidence and what the tool changed on the page.
  2. Review on a schedule. Do not allow silent adaptation indefinitely. Look at the heal log after each release and approve or reject each entry.
  3. Use suggestion mode if you can. Let the tool propose a fix and require a person to accept it.
  4. Never let it change assertions. Healing may change how an element is found. It must never change what the test expects, which is the intent of the test.
  5. Write fixes back. Because healing only repairs the run, update the script with the better locator.
  6. Limit the scope. Not every element should heal on its own. Critical flows such as payment may need stricter checks, such as visual testing, which checks how the page looks.
  7. Watch the trend. A sudden increase in the pass rate needs an explanation, because self-healing automation can make a suite look healthier than it is.

Example: a checkout refactor, with and without healing

The numbers are made up.

A team has 400 automated tests that run in the browser. A front-end refactor renames IDs across the checkout page. Without healing, 60 tests fail on locators, and each test failure needs a look. An engineer needs about two days to repair them, and during that time the team has no reliable regression result.

With healing switched on, the tool repairs locators during test execution so that each test continues, and 55 of those 60 tests pass with healed locators. The QA lead sees each heal in the report. Five still fail because their elements were removed on purpose. The engineer spends half a day on those five and one more hour reading the heal log.

In the log, two heals look wrong. In a test for editing an address, the tool clicked "Remove address" where the test wanted "Save address". The test only checked that the page still loaded, so it passed. The engineer fixes both locators, and adds a stronger assertion that the saved address appears in the list.

The result: about two days of repair work shrink to roughly a day. The saving is real, but it exists only because a person read the log. Without that review, two tests would have stayed green while testing the wrong thing.

Common mistakes

  • Treating self-healing as a replacement for good locators. Stable role, text or test ID locators prevent breaks and cost nothing.
  • Letting it run silently. If nobody reads the log, wrong heals pile up unseen.
  • Expecting it to fix flaky tests. Timing problems and unstable test data need different fixes.
  • Using it on critical checks without extra safeguards. Add visual regression testing or data checks to payment and permission flows.
  • Believing a vendor's figures for lower test maintenance effort without a pilot. Measure the real effect on your own suite before you commit.

How software can help

Many test automation frameworks, cloud platforms and other automation tools now offer healing, in different forms: simple fallback locators, similarity scoring and AI-based choice of elements. Compare them on the points above, not on the label. Ask whether the self-healing platform shows every heal, lets you approve it and export it as a script change. A plain Selenium or Playwright suite with well-chosen locators and a short review habit is a valid alternative to any self-healing tool. Run a pilot on one flaky area and compare maintenance time before you decide. Tools built on AI agents, often called agentic AI, that work from plain-language steps raise the same questions about review.

Next step

Choose one part of your end-to-end testing suite that breaks often, switch on healing there for one release, and review every heal by hand. Then decide whether self-healing test automation earns a wider role in your suite, based on how many heals were right.

Entities in this article

End-to-end testing AI agent Generative AI

Related articles

RSS