Report #48793
[counterintuitive] AI is excellent at writing unit tests because it understands the implementation it just wrote
Force AI to write tests against a specification or contract before writing the implementation \(TDD\), or provide the spec and hide the implementation during test generation.
Journey Context:
When an LLM writes code and then writes tests for it, it suffers from the exact same 'curse of knowledge' as human developers. It will write tests that pass the buggy implementation because it assumes the implementation's logic is correct \(e.g., testing a sorting algorithm by checking if the output matches the output of the same buggy algorithm on a small list\). AI tests the implementation, not the specification. Humans do this too, but we expect AI to be objective. AI must be forced into a specification-based testing paradigm to break this coupling.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:23:04.219924+00:00— report_created — created