{
  "id": 22694922,
  "title": "100% Test Coverage and the App Still Had 2 Real Bugs",
  "url": "https://urgent.news/2026/11/30/100-test-coverage-and-the-app-still-had-2-real-bugs",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-30T00:42:43.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/shipstackai/100-test-coverage-and-the-app-still-had-2-real-bugs-400k"
  },
  "original_language": null,
  "account": "In an article about test coverage, an AI agent was given a simple Express shopping cart API and tasked with writing tests. Astonishingly, the AI achieved 100% line coverage. However, this did not guarantee the absence of bugs. The API, comprised of 26 lines of code, allowed users to add items, calculate totals with coupons, and remove items. It had basic validation for item names, but no other checks.\n\nThe reporter then conducted \"probing tests\" to uncover hidden issues. First, they tested negative quantities, which the API accepted without error and responded with a 201 status code. They also tested sending non-numeric quantities, which resulted in the total returning as \"NaN\" (not a number). These two tests exposed real bugs in the system, despite the 100% line coverage. This demonstrates that coverage only measures which lines of code were executed, not their correctness.\n\nTo address these issues, the reporter added a single line of validation: if the quantity was not a finite number or was zero or less, a 400 error should be returned. Running the tests again, all nine tests passed, and the coverage remained at 100%. The reporter emphasized that coverage is simply a minimum check for code execution, not a measure of correct outputs. The tests that reveal real bugs focus on invalid inputs and unexpected behaviors.\n\nIn conclusion, the reporter advised that developers should write tests for the \"what should never be allowed\" scenarios at each endpoint before trusting the green checkmark indicating coverage. This precautionary measure ensures the app is less prone to breaking due to unnoticed bugs. The full experiment, including code and tests, can be found in a video available at https://youtu.be/JqhsD936gD0. The report is part of a series called \"Ship Stack,\" which presents real experiments on actual backends with concrete numbers and avoids vague explanations.",
  "summary": "Everyone says check your test coverage. So I gave an AI agent a messy shopping cart API in Express, asked it to write tests, and measured the coverage. It hit 100%. The app still had two real bugs. Here is what happened. The app A small Express cart API, 26 lines. You can add items, get a total with two coupon codes, and remove items. It looks fine at a glance. Nothing is validated except the…",
  "summary_source": "publisher",
  "key_points": [
    "AI achieved 100% line coverage in Express API tests",
    "Probing tests exposed bugs despite 100% coverage",
    "Added validation to prevent 400 errors for invalid inputs"
  ],
  "editors_take": "Developers who rely solely on high coverage metrics risk missing critical errors caused by invalid inputs and unexpected behaviors in their application code.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}