A test result needs a control
Quick experiments that say what a green or a red run means
When an AI coding agent changes an app and adds a test for it, the report that comes back is "all tests pass". A pass says less than it seems to. The same agent wrote the change and the test, so both can rest on the same misunderstanding.
A control helps. It is one more run in which a single thing is changed on purpose and the result is known in advance. The three below each cost one run, and each changed what a result meant.
Background
The examples come from a business app built with Codeer.LowCode.Blazor (CLB), a low-code library for Blazor made by Codeer, where I work. Its screens are JSON design files with small C#-style scripts next to them, and its UI tests drive a browser.
None of the controls depend on that setup. They need a test that can run on its own and a change small enough to undo by hand.
Make the new test fail once
The change: a screen used to ask the server for a set of rows on every edit. Now it keeps its own copy, loaded with the page. Three places on that screen can change those rows, and each has to update the copy.
The agent added a test for one of them. It changes a row in a dialog, makes an edit whose result depends on that row, and checks the stored value. The test passed.
The control was to take out the one line that updates the copy after the dialog saves, and run the test again. It failed, and the stored value was the one a stale copy would produce. Then the line went back in.
Without that run, the pass could have meant that the test never touched the copy at all.
Switch off the fallback
The same change kept the old server request as a fallback, for a row that has no copy yet. That is a sensible thing to keep, and it can hide a failure. If the copy were never filled, every edit would quietly fall back, every result would be right, and every test would pass. The change would do nothing except look finished.
The control was to make the fallback return no rows and run the edit test again. It still passed, so the result was coming from the copy. Had it failed, the earlier passes would have been passes for the wrong reason.
Run a failure on the version before
Later the framework packages were upgraded, and three tests in one class failed. The obvious reading was that the upgrade had broken something.
The control was to run that class alone on both builds. One test failed on the upgraded build, and the same test failed on the build from before the upgrade, in the same way: a click on a menu link landed while the page was still covered by its loading overlay. The upgrade had nothing to do with it. Two neighbouring test classes already waited for the overlay to clear. This one didn't, and had been passing anyway.
With the same wait added, the class passed on the upgraded build, twice in a row.
A red test after a change is only a correlation. Running it on the version before is the cheapest way to check the cause.
What the controls rely on
Each control took two things: a test that can run on its own, and an edit small enough to undo by hand.
Two features of this project kept that cheap. The scripts are interpreted when the app runs, so removing a line needs no build. The design files are in git, so the earlier version of any screen is one checkout away. The third control needed one more thing, the build from before the upgrade, which is a good reason to keep the old build until the new one has passed its tests.
An agent can run all three controls itself, so they belong in the file that holds the project's rules for the agent:
- A new test is not reported as passing until it has been seen to fail.
- When a change keeps a fallback, the tests are run once with the fallback switched off.
- A test that fails after an upgrade is run on the previous version before the upgrade is blamed.
Examples from CLB 1.3.68 and 1.3.71, run on 2026-11-20 and 2026-11-24. Disclosure: I work at Codeer, the company behind Codeer.LowCode.Blazor. This post was drafted with AI assistance; the workflow and the examples are from my own project, and I checked every claim against the test output.
Comments
Join the discussionNo comments yet. Be the first to comment.