{"slug": "your-tests-passed-that-is-not-the-same-as-correct", "title": "Your Tests Passed. That Is Not the Same as Correct.", "summary": "Raghu Bharadwaj, writing for TECH VEDA, warns that a passing test suite does not prove code correctness, citing Edsger Dijkstra's 1970 observation that testing can show bugs but never their absence. He argues that AI-generated code and tests can agree while both miss edge cases, urging engineers to write tests that try to break code rather than confirm it.", "body_md": "*A green test suite does not mean your code is correct; it means you have not found the failure yet. Dijkstra's warning is a reminder to write tests that try to break your code, not tests that confirm it. That discipline matters more now that AI produces code which passes the easy tests while hiding the case that will fail in the field.*\n\nIn 1970 Edsger Dijkstra wrote a sentence every engineer should remember: \"Program testing can be used to show the presence of bugs, but never to show their absence!\" It is short, and it is exact. A test that fails tells you something certain: there is a defect here. A test that passes tells you far less than it seems to. It says only that this input, on this path, did not fail this time.\n\nA passing test proves you have not found the defect yet. Nothing more.\n\nMost engineers read that line, agree with it, and then work as if the opposite were true. The suite goes green and the task feels done. But green is not a proof of correctness. It only means no failure was caught this time. The gap between those two things is where most production bugs come from — the input you did not think of, the ordering you did not try, the board that behaves unlike the one on your desk.\n\nGreen is the absence of a caught failure, not the presence of correctness.\n\nAI has made the gap wider. A model can produce a function and a set of tests that pass together in seconds, and both can be wrong in the same direction. The code handles the cases the tests check; the tests check the cases the code handles; neither touches the edge that fails in the field. It all looks finished. The tool can pass your tests without understanding your intent, because it was working towards a green result, not a correct system.\n\nThe tool can make the code and the test agree, and both can still be wrong.\n\nSo the discipline behind Dijkstra's line is now a core engineering skill, not a nicety. When code and tests are both cheap to generate, the scarce ability is the one that goes looking for what is still broken. That is a scientific habit: you do not try to confirm your idea, you try to break it, and you trust it a little more only after it survives an honest attempt to fail.\n\nDo not try to confirm your code. Try to break it.\n\nThe shift is from writing tests that agree with your code to writing tests that try to break it. A few concrete habits:\n\nNone of this means tests are not worth writing; they are one of the best tools we have. It means you should know exactly what a passing test does and does not tell you. A test suite is a record of the failures you went looking for, no wider than your own sense of what could go wrong. Widen that, and the tests get stronger. Skip it, and green becomes a false reassurance that hides the defect until a user finds it for you.\n\nLook hardest at the code you are most sure of.\n\nLearn to read and break code, not only run it, and treat a passing test as a question rather than an answer.\n\n— Raghu Bharadwaj\n\n*Based on Edsger W. Dijkstra, \"Notes on Structured Programming\" (EWD249), 1970. Originally published on TECH VEDA.*", "url": "https://wpnews.pro/news/your-tests-passed-that-is-not-the-same-as-correct", "canonical_source": "https://dev.to/raghu_bharadwaj_404e60eb0c/your-tests-passed-that-is-not-the-same-as-correct-370e", "published_at": "2026-08-02 17:37:19+00:00", "updated_at": "2026-08-02 18:12:58.129414+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence"], "entities": ["Raghu Bharadwaj", "Edsger Dijkstra", "TECH VEDA"], "alternates": {"html": "https://wpnews.pro/news/your-tests-passed-that-is-not-the-same-as-correct", "markdown": "https://wpnews.pro/news/your-tests-passed-that-is-not-the-same-as-correct.md", "text": "https://wpnews.pro/news/your-tests-passed-that-is-not-the-same-as-correct.txt", "jsonld": "https://wpnews.pro/news/your-tests-passed-that-is-not-the-same-as-correct.jsonld"}}