Does Test-First Pay Off for Coding Agents? A Controlled Study on SWE-bench Verified
Instruction files such as CLAUDE.md and AGENTS.md often contain rules about tests. I tested whether one line about test order changes what a coding agent produces. The agent, Claude Code 2.1.332 with claude-sonnet-5-5, solved 60 SWE-bench Verified tasks under five conditions: no rule (A), "test first" (B), "fix first" (C), "no tests" (D), and a second "test first" wording (B2). There were 480 runs in total. The test-first rule cost about 11% more than the fix-first rule: a geometric-mean ratio of 1.109, 95% CI 1.07 to 1.15, p ≈ 1.2 × 10⁻⁶. The resolve rate was nearly the same: 91.7% for B and 90.0% for C, a difference of 1.7 points (95% CI 0.0 to 4.2). Equivalence within a ±15-point margin holds. The agent followed the rule in 97 to 99% of runs. The tests it wrote agreed with the reference fix in 76 to 83% of cases. The results apply to one agent, one model, Python tasks, and tasks under one hour. This record contains the paper, the run data, the analysis output and the scripts.
Authors
- Orkhan Gojayev
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24726979
- Primary Topic
- Software Engineering Research
- Type
- preprint