Integration Tests Exposed 3 Unfixed Bugs That 90% Unit Test Coverage Missed
A developer building an MCP failure library — a shared memory tool that lets AI agents warn each other about recurring errors — discovered that three previously "fixed" bugs were still present after writing a real end-to-end integration test. Despite achieving over 90% unit test coverage across the SQLite layer, MCP transport, and retry logic, production failures occurred almost every other day due to untested component interactions. The integration harness spun up the actual server, used the real STDIO transport and SQLite database, and ran full scenarios without mocks, revealing issues including a cache queried before it finished loading, JSON-RPC payloads being split mid-stream, and a flawed deduplication query that returned random results after 150 database entries. None of these bugs were detectable in isolation because unit tests confirmed individual functions worked correctly but could not verify system-wide behavior. The developer also noted practical pitfalls such as accidentally locking the live database during testing, recommending the use of temporary files, process timeouts, and proper cleanup routines.
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