The problem Most codebases carry large amounts of untested code. Teams don't know what is untested, so critical logic often ships with zero tests. Writing good tests by hand is slow: we timed ourselves writing five realistic pytest tests with fake data, edge cases and error cases, and it averaged 27 minutes per test. Faced with that cost, developers skip tests, bugs reach users, and every change becomes risky. Our solution TestGap Agent turns "raise our test coverage" into a single instruction. A developer opens their repository in IBM Bob 2.0, switches to our TestGap Writer mode and types: "Run the TestGap playbook on sample_project." Everything else is automatic: 1. Scan: runs the existing tests with coverage to measure the starting point. 2. Find: maps every uncovered line to its function using Python's AST and ranks the gaps by priority (public API, number of untested lines, and whether the function is named in the project docs). 3. Write: Bob starts one subagent per source file, in parallel. Each subagent reads the source, its gaps, the README and business rules, and writes pytest tests with seeded Faker data. 4. Run and fix: all tests run; Bob repairs failing tests, with at most three tries per file. 5. Report: a Markdown report shows coverage before vs after, tests added, pass rate, run time, estimated manual time saved, and possible bugs. Two design choices make it trustworthy. First, it never changes real code. Bob's edit permission is restricted at the tool level to the generated-tests folder, and the report double-checks with git that zero source files changed. Second, tests check what the code should do, not just what it does. When the code contradicts its documentation, the test is not bent to pass; it is marked as a "Possible bug" for a human to review. We split the system into "hands" and "brain". The hands are a small deterministic Python package (scan, gaps, run, report, clean) with 215 unit tests, producing stable JSON that Bob reads. The brain is Bob, following a written playbook, doing the work that needs judgment: reading docs, writing tests and deciding whether a failure is a test mistake or a real bug. Results On our demo shop backend, one instruction took coverage from 21.5% to 100% and added 161 tests, 160 passing (99.4%), in 5 minutes 41 seconds. At our measured 27 minutes per test, that is roughly 72 hours of manual work. Zero lines of real code were changed. It also caught the bug we planted to test it: the business rules say a discount can never exceed 100%, but apply_discount accepted 150% and returned a negative price. Business value TestGap Agent helps teams with legacy code and low coverage, leads who want safer releases without pausing feature work, and new joiners, who learn the code by reading its tests. It turns a task people postpone for months into a few minutes of reviewing a pull request.
Category tags: