AI-Generated Tests Scored 94% Coverage But Failed Basic Mutation Testing
A developer used an AI model to generate a pytest test suite for a small Python CSV-parsing library, achieving 94% code coverage with 20 auto-generated tests. However, when mutation testing was applied by deliberately altering the source code logic, one mutation survived undetected — revealing a gap in the AI-written tests. The AI had written tests for missing 'Time' values but never tested the case where a row lacked a 'Course' field entirely, leaving that logic branch unverified. A second mutation, which changed the return value of an invalid date parse, was correctly caught because the AI had explicitly tested for a None return. The experiment highlights a key limitation: high code coverage measures which lines were executed, not whether the underlying logic is robustly verified against behavioral changes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in