Self-Healing Tests That Know What Your Team Is Doing

A self-healing test is a test that repairs itself after a failure. Donobu auto-heal does it as a teammate would: it reads open pull requests first and opens its own fix for review.

Cover Image for Self-Healing Tests That Know What Your Team Is Doing

A self-healing test is an automated test that repairs itself when it breaks, so a person does not have to rewrite it by hand. The useful kind finds why a test failed, changes the test, proves the change works, and hands it over for review.

Most tools stop at the first part. They patch one selector and move on. Donobu auto-heal now does the rest of the job, including the part where it checks what your team is already doing.

What is a self-healing test?

A self-healing test is a test that detects its own failure and proposes a repair. The repair might be a new locator, an updated assertion, or a fix to a shared helper.

"Self-healing" covers a wide range of behavior. At one end, a tool swaps a broken selector for another one at run time. At the other end, an agent reads the failure, finds the cause, edits the code, re-runs the affected tests, and opens a pull request.

The second kind is the one an engineering team can trust. A change that lands in a pull request has a diff, a reviewer, and a history.

A heal pull request that names the open pull request its fix conflicts with

Why does selector failover fall short?

Selector failover fixes the symptom, not the cause. When a locator stops matching, it tries a fallback locator and carries on.

That works when the page changed and nothing else did. It breaks down in three common cases:

  • The test failed because the product behavior changed, and the old check is now wrong.
  • The fallback can match a different element, so the test passes while checking the wrong thing.
  • The fix lives only in that one run. Nobody reviews it, and nobody can see it later.

Failover also knows nothing about the people around it. It cannot tell that a teammate opened a pull request yesterday that already fixes the same test.

QuestionSelector failoverDonobu auto-heal
What it changesA locator, at run timeTest code, helpers, and cached steps, in a branch
How the change shipsInside the run, unseenAs a pull request a person reviews
Knows about open pull requestsNoYes, and names the ones it conflicts with
Earlier unmerged fixNothing to carry: the fix lived in one runCarries it to the newer commit and re-checks it

What if a teammate is already fixing the same test?

Then auto-heal should not fix it a second time. Before it heals, Donobu now lists the open pull requests and merge requests into the branch under test. It supports GitHub and GitLab, skips its own heal pull request, and counts drafts.

For each failing test, the agent judges whether a person's request already repairs the failure. If it does, auto-heal changes nothing and names that request in its report.

If the request is unrelated, auto-heal heals as usual. When its fix overlaps with an open request, the heal pull request says which request it conflicts with. Whoever merges second knows what to expect.

This matters more than it sounds. A person might fix three failing tests by adding a helper to a shared file. A tool that never looks writes its own copy of that helper in the same file. The two pull requests then collide on merge, and a reviewer has to untangle them.

What happens to a fix when the next commit lands?

An earlier fix that nobody has merged yet is carried forward to the new commit, not thrown away. Auto-heal treats the heal branch as work in progress.

When the heal branch holds a fix for an older commit, auto-heal does four things:

  1. It three-way merges each file of that fix onto the new commit.
  2. It re-runs the tests those files reach.
  3. It keeps only the changes whose tests pass.
  4. It lists what it carried in the pull request.

Some files are left out on purpose. A file that conflicts with the new commit is not carried. Neither is a cache file whose spec has changed since. Both are shown to the agent as an earlier attempt, written for older code, not as an instruction.

Later rounds check the carried files again. If a change that passed in round one breaks in round three, it goes back to the agent as a regression.

Which changes does the pull request keep?

The pull request keeps changes for tests that passed after the change. When at least one test passes, auto-heal puts back the changes for tests that still fail, as long as those changes touch only test files, their cached steps, and their snapshot baselines.

The reason is plain. A pull request that says "this fixes the checkout test" should not also carry half-finished edits for a test that is still red. Merging for the fix would merge the edits too.

Two rules cover the edge cases:

  • If a helper or configuration file changed as well, auto-heal keeps those changes and names them as changes for tests that did not pass.
  • If no test passed, there is no fix and nothing is published.

Review flags add one more layer. If a fix wraps a click in a retry, for example, the pull request says so. A retry can hide a real defect, and the reviewer should decide that, not discover it later.

What if the CI job runs out of time?

Auto-heal still diagnoses every failure. It works to the CI job's deadline. On GitHub Actions you set it with DONOBU_HEAL_DEADLINE_S. On GitLab it reads the deadline automatically.

When the job has no time for another repair round, heal now investigates the tests that are still failing first. Each one ends with one of three outcomes:

  • A fresh diagnosis, if there was time.
  • The earlier verdict, kept, if a strong one already stood.
  • A plain note: "not investigated: the job's time ran out."

So a red test never ends with silence. You learn what the agent found, or that it did not get to look.

Who reviews a self-healed test?

A person does. Auto-heal opens a pull request instead of pushing to your branch. The pull request lists what changed, which tests were re-run, what was carried over, and what was left out.

This is how Donobu works in general. AI agents run the regression tests. SDETs review every result. Our tagline says it: AI runs the tests. We own the quality.

The tests themselves are native Playwright, and you own them. There is no proprietary format and no lock-in. Everything runs local-first or in your own environment. If you stopped using Donobu tomorrow, the tests and the fixes in your repository would still be yours.

For the full story of how failures reach your team, see Failing tests now arrive as a pull request.

What makes a self-healing test worth having?

A self-healing test is worth having when its fixes behave like a good teammate's. It checks what others are doing, builds on earlier work, proves its changes, says what it could not do, and asks for review.

To set up auto-heal on your own suite, start with the Donobu docs.