You have seen this pull request. Every test passes, coverage sits at 92%, and the test file is twice the length of the code because someone generated it. It gets approved, it lands on main, and two weeks later a discount calculation bug shows up in production anyway. When you go back and read the test, you find it passed before the change, passed after it, and would still pass if you deleted the logic entirely. This is the gap mutation testing closes: it measures whether your tests catch a broken change, not how many lines were executed while they ran.
This is no longer an academic curiosity. In Technology Radar Volume 35 (updated November 2026), Thoughtworks moved mutation testing to Adopt, and the reason is blunt: AI assistants increase the volume of generated code and tests, which makes coverage metrics "easier to inflate with superficial tests". A technique that used to be a nice-to-have for teams with spare time is now a guardrail worth having.
100% coverage that verifies nothing
Line coverage only tells you a line executed during the test run. It says nothing about whether an assertion cared about the result. A small example:
// 10% off orders of 1,000 and up
export function discount(total: number) {
return total >= 1000 ? total * 0.9 : total
}// the shape of test you see a lot in generated code
it('calculates the discount', () => {
expect(discount(1200)).toBeDefined()
expect(typeof discount(500)).toBe('number')
})Coverage for discount is 100%. Both branches of the ternary run. And this test stays green if you flip >= to >, change 0.9 to 0.8, or return total and drop the discount altogether. It protects nothing. It confirms the function doesn't throw.
The trouble is that tests like this look fine in review. They have readable case names, they have assertions, coverage goes up. A reviewer working through 20 files in 15 minutes waves them through.
What mutation testing actually measures
Mutation testing lets a tool make small deliberate edits to your own code and then checks whether your existing tests notice. Each edit is a mutant: flip >= to >, swap + for -, turn true into false, delete a statement.
Then it runs your suite:
- The tests fail after the edit, so the mutant is killed. Your test did its job.
- The tests stay green, so the mutant survived. Someone broke the logic and nobody found out.
The proportion of killed mutants is your mutation score, and it answers the question coverage can't. The Radar entry describes it as the most honest signal available for the real fault-detection ability of a suite, and the thing it hunts for is "perpetually green" tests that pass regardless of logic changes because assertions are missing or everything is mocked away from the real logic.
Where AI-written tests usually fall short
The failure modes repeat:
- Weak assertions:
toBeDefined(),not.toBeNull(),toHaveBeenCalled()with no check on the arguments. - Every dependency mocked, until the test exercises the mocks instead of your code.
- Assertions that copy the formula straight out of the implementation, so a wrong formula produces a confidently wrong test.
- Excellent happy paths and no edges: zero, negative numbers, empty strings, time zones.
Developer sentiment points the same way. Sonar's State of Code Developer Survey 2026, covering more than 1,100 developers, found 96% don't fully trust AI-generated code, yet fewer than half (48%) always verify it before committing, and 38% say reviewing AI-generated code takes more effort than reviewing a colleague's.
The test side is more uncomfortable. SmartBear's State of Software Quality and Testing 2026, as reported by SD Times, found that 72% of leaders and 56% of developers trust AI-generated tests more than human-written ones, while 46% of teams have already shipped AI-generated code that later failed. If the same model writes the code and the tests, nothing in that loop is independently checking anything. Mutation testing is how you put a tool back in the role of the sceptic.
Running it without destroying your CI times
Mutation testing is slow by nature: it reruns tests once per mutant. Run the whole repository on every pull request and your team will switch it off inside a week. Start smaller.
- Pick the module where a bug hurts: billing, tax calculation, access control. Not the whole project.
- Install it and do one run locally. On JS/TS, Stryker is the straightforward choice.
- Read the list of survived mutants and fix the assertions. Don't just add more tests.
- Record the current mutation score as your baseline and set the threshold slightly below it to stop regressions.
- Only then put it in CI, in incremental mode, so it covers what changed.
# install and answer the init questions; you get stryker.config.mjs
npm init stryker@latest
# first run, scoped to one module
npx stryker run --mutate "src/billing/**/*.ts"
# in CI, only what changed
npx stryker run --incrementalStryker's incremental mode stores the previous result in reports/stryker-incremental.json and diffs your code and test files against it, reusing results for mutants nothing touched. One caveat worth knowing: it only looks at mutated files and test files, so it won't notice a dependency bump or a changed environment variable. When you suspect stale results, rerun with --force plus a narrow --mutate pattern. Other ecosystems have equivalents: Pitest for Java, cargo-mutants for Rust.
Should every project use it?
No. In my view it pays off on pure business logic where a bug costs money or exposes data. For glue code wiring an API to a UI, or components that get redesigned every sprint, you'll just get a screen full of mutants and no insight.
The other trap is turning mutation score into a KPI and chasing 100%. Do that and people start writing tests to kill mutants rather than to describe behaviour, which is worse than the shallow tests you set out to fix. A better rule: every survived mutant in a critical module gets read by a human, who then decides case by case whether to strengthen the test or accept it.
Tooling matters less than how you review. If you want pull requests full of AI-written tests to be reviewable at all, making them smaller helps more than anything else, which we wrote about in stacked pull requests.
When should a small team start?
The day you have one important module nobody dares to touch. Spend half a day on a single run and read the output. You don't need it in CI on day one. Seeing how many mutants survive a suite you believed was thorough changes how your team writes tests more than ten meetings about code quality ever will.
If your team has plenty of tests but bugs still reach production, or you're setting review standards for AI-assisted code, we're happy to talk.
Talk to our team


