100% Test Coverage Did Not Stop Two Real Bugs in an Express Cart API
A developer asked an AI agent to write tests for a small Express shopping cart API and measured the resulting coverage, which reached 100%. Despite this, the application still contained two real bugs: it accepted negative item quantities and returned NaN totals for non-numeric quantities. The developer argues that line coverage only shows which code ran, not whether the results were correct. After adding one line of validation and tests for invalid inputs, the bugs were fixed while coverage stayed at 100%. The takeaway is that tests probing forbidden inputs, such as negative numbers and wrong types, are needed to catch real defects.
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