glossary · end-to-end testing

Self-healing tests

what is self-healing tests?

A self-healing test repairs itself when the interface changes, rather than failing because a selector moved. Implementations differ enormously: some retry with alternative selectors, some ask a model to re-find the element, and some regenerate the test file and open a pull request. The question worth asking of any of them is what happens when the healing is wrong.

Healing is a guess about intent. When a button labelled "Proceed to checkout" becomes "Continue", a healer that finds the new button is correct. A healer that finds a different button entirely, and passes, has just told you your checkout works when nobody checked.

That is why the interesting part of any self-healing claim is the reporting, not the healing. A tool that heals silently converts a signal into a green tick. A tool that says what it healed, and to what, lets a reviewer catch the wrong guess in the one place they were already looking.

The second question is where the repaired artefact goes. Tools that keep tests as code have to write the repair back into your repository, which means reviewing a machine-authored diff. Tools that keep tests as intent have nothing to write back, because the sentence did not change.

in smolanalytics

There is no selector to heal, because there is no test code. When a recording stops fitting, the run is reported as stale and the agent works the flow out again from the original sentence, so the artefact that gets repaired is a cached recording rather than a file in your repository. Nothing machine-authored is committed to your code.

How it works shows where this fits in the loop, and the docs have the exact behaviour.

questions

Is self-healing the same as flaky-test handling?
No. Self-healing addresses a test that broke because the interface changed. Flakiness is a test that gives different answers on unchanged code. A healer applied to a flaky test just makes the unreliability quieter.

keep reading