Dev.to WebDev 🛠 Dev 👁 0 📖 6 min read

A green test suite is a claim, not a proof. Here's how I measure it.

Every team I've worked with treats a green end-to-end suite as evidence the product works. It's evidence of something narrower: that the steps in the tests ran and the checks they make held. Whether those checks would no

Every team I've worked with treats a green end-to-end suite as evidence the product works. It's evidence of something narrower: that the steps in the tests ran and the checks they make held. Whether those checks would notice a real regression is a separate question, and most suites are never asked it.

For the KaneCLI hackathon by TestMu AI I built Saboteur to ask it on purpose. This post is about the design decisions, the failure modes I hit, and what the numbers taught me. If you've done mutation testing at the unit level, this is the same idea pushed up to the browser.

The loop

  1. Plant. A bug is a small git patch: the cart total skips the last line, the "+" button does nothing, SAVE10 takes 1% instead of 10%, login redirects to the wrong page. Each one is applied to a temporary copy of the app, which is then built and served. The real source is never touched.
  2. Hunt. Kane CLI replays the _test.md suite against the broken build in real Chrome.
  3. Score. Caught or slipped, per bug.
  4. Close the gap. For each bug that slipped, Claude writes a new test. It's kept only if Kane passes it on the correct build and fails it on the bugged one. If either check misses, Kane's failure text goes back to Claude for another attempt, up to three.

The first result set the tone. Four reasonable starter tests (browse and add to cart, cart shows the item, checkout happy path, login) caught 0 of 10 planted bugs. They clicked all the way through checkout and never asserted that the total was right.

Decision 1: turn self-healing off on bugged builds

Kane can adapt when a page changes, which is exactly what you want against flaky selectors and exactly what you don't want here. A test that quietly works around a broken button has just certified the broken button. Bugged builds run with --no-adaptive-heal; clean builds don't. It's one flag, and the whole method is meaningless without it.

Decision 2: a failed test is not a caught bug

This took more work than anything else. During development I watched tests "fail" because:

  • Chrome crashed mid-run (browser_disconnected)
  • the disk filled up and screenshots couldn't be written
  • the tool's own page check errored (analyzer_failed)
  • a hover simply didn't land the first time

If any of those count as catches, the score is fiction. So the verdict rules are strict:

  • Infrastructure failures are errors, never catches. They're retried and excluded from the score.
  • Every catch is confirmed: the failing test is re-run on its own. If it doesn't fail again, the first failure is treated as flaky and the whole suite runs again.

That second rule paid for itself on a real run against React TodoMVC: two tests failed with analyzer_failed on bugs they had nothing to do with. The confirm runs passed, and both bugs were correctly scored as slipped instead of inflating the number.

Decision 3: the model doesn't get to grade its own homework

The accept rule for a generated test is mechanical: Kane exit 0 on clean, exit 1 on the bug. Nothing Claude says about its own test matters. The same rule judges the "duel" mode, where one Claude agent invents bugs the current suite misses and another writes tests to catch them; a red-team bug only counts if Kane can see it in the browser (its check passes on the bugged build and fails on the correct one). That run ended Red 3 : Blue 3, with three real holes found and closed: the cart badge counted products instead of items, free shipping was checked before the discount, and signing out left you signed in.

I applied the same idea to the least glamorous output, the launch post. saboteur post builds a fact list from the reports, and if Claude writes a number that isn't in that list, the post is rejected. It's a small thing, but it's the same principle: generated output is accepted on evidence, not on fluency.

Bug counts mislead; map them to the spec

TodoMVC's four starter tests caught 2 of 10 bugs, which reads like partial coverage. When I mapped each bug to the spec rule it breaks (counter, filters, clear completed, edit, delete, toggle all, adding a todo), every one of the 7 rules with a planted bug still had a bug that slipped. Any of those rules could break and the suite would stay green. After Claude's Kane-proven tests: 0 of 7, and 10/10 bugs caught.

That's now part of the report as "requirement coverage", and it's the line I'd show a product owner. "We catch 20% of bugs" invites a shrug. "None of these seven rules are actually protected" doesn't.

Things that broke, and what I changed

  • Runtime. Every bug is a fresh build plus a full browser run, and the first full attack took hours on a Windows laptop. Two tests at a time, stopping at the first failure on attack runs, and saving progress so an interrupted run resumes brought a caught bug down to a few minutes.
  • A two-hour hang. On Windows, the CLI runs behind a cmd launcher, so my timeout killed the launcher and left the real process running. The fix was killing the whole process tree, plus a watchdog that stops a run after ten minutes with no output.
  • Disk. Browser tools keep screenshots per run. A full disk looks exactly like flaky tests. The readiness check (saboteur doctor) now refuses to start under 2 GB free.
  • The retry loop never fired. Across every real fill, with two different Claude models, the first test was always proven. That's good news about the models, but it means the feedback path is verified by automated tests rather than a live run. I'd rather say that plainly than dress it up.

Making it usable, not just demoable

A measurement nobody runs is a hobby. So:

  • saboteur gate --min-score 100 exits non-zero until the suite catches enough planted bugs, and a bug with no verdict blocks too. Wired into CI, a required check refuses the merge until Kane signs off, and the PR gets a comment listing what would ship unnoticed and linking the Kane run behind every catch.
  • It ships as an agent skill, so a coding agent can run it: "use saboteur to check my tests". The skill tells the agent to state the credit cost and ask before spending, and never to report a number that isn't in the report.
  • Pointing it at your own app is a config file, a ROUTES.md with the facts the tests should check, and a folder of patches.

What I'd tell a team adopting this

  • Start with five to ten bugs that map to rules you'd be embarrassed to break. Totals, discounts, permissions, persistence.
  • Treat every "caught" with suspicion until it's confirmed. Your infrastructure lies more often than you think.
  • Assert exact values near boundaries. A cart that drops just under the free-shipping threshold after a discount catches far more than a happy-path checkout.
  • Run it on a schedule or behind a label, not on every push. Browser runs cost time and credits.

The question I now ask about any suite: if the feature this test covers were broken, would the test fail? Saboteur is just that question, asked ten times, with a browser as the judge.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.