Self-healing tests that never heal assertions
The fear about self-healing tests is a fair one: a bad heal can quietly tell everyone the product is fine. Saffron draws a line in code. It may repair how a step is done. It does not touch what a step checks.
Heal the path, never the verdict
A scenario has two kinds of steps. Given and When steps are the path: how you get to the state you want to check. Then steps are the verdict. When the UI changes, repairing the path is the point of self-healing. Rewriting the verdict until it matches the page is how a real bug ships with a green build.
Scenario: Book a sea view room Given I am on the rooms page # may be repaired When I book the sea view room for 2 nights # may be repaired Then the booking is confirmed # never healed And the total is NOK 2,296 # never healedWhat happens when a Then fails
If a Then step fails as written, the run is red and stays red. The agent does not get to adapt the check, and the report says so:
REDBook a sea view room Saffron never adapts assertions. If this change is intended, update the .feature file or re-record the scenario.If the change is intended, you update the feature file, or accept the feature edit Saffron suggests, and the scenario records again. The decision about what correct means stays with you.
Enforced in code, not in a prompt
This is not an instruction the AI is asked to follow. The runner enforces it: under the default strict policy, a heal changes how a check is reached, never what it checks, and it never rewrites the steps that already passed.
Some teams want flexibility for checkpoints in the middle of a long scenario. They can opt into --assertion-policy adaptable-mid: a mid-scenario check may then adapt, each time with a note, a suggested feature edit, a proof replay and your accept. The final checks of every scenario stay strict under any policy.
Every heal is a proposal
- Nothing lands on its own. A heal is filed as a proposal: the changed recording, beside the one it replaces.
- A proof replay checks it first, with no AI at all, and stamps the result on the proposal. Accepting them all in one go skips any whose proof failed.
- You accept or reject it, in the terminal, in VS Code or JetBrains, or from the run's replay page. A heal made in CI travels back to your editor for review.
- Yellow means it needed help. A scenario that passed only after a heal is not reported green, so a quietly healing suite stays visible.
Why it matters for AI in testing
An AI agent is very good at getting through a changed page. That is exactly why it should never be the one deciding whether the result is right. Saffron uses AI for the path and keeps the verdict deterministic: once recorded, every run replays with zero AI calls, and every check means what it meant when you wrote it.
Read the docs on assertions and healing, or see how Saffron works without step definitions.
Try it on your app
npm i -D saffron-ai, then npx saffron init --examples installs a small example suite to run. Free to use, including commercially. Read the docs or watch the short videos.