AI-written tests are all green: how do you know they're worth anything?
Short answer
Use mutation testing: a tool (in Java, PIT) makes small changes to the code and reruns the tests; if they stay green, that behavior isn't checked. The mutant kill rate is more honest than line coverage.
3 points to say:
- A surviving mutant = the tests don't check that behavior, even though the line was executed.
- Line coverage doesn't measure assert quality: AI-written tests often assert back exactly what the mock returned.
- Write tests from the spec first, before letting AI implement; tests the same agent writes after the code can confirm its own bug.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.