cs.SEFeb 8, 2026

Rethinking the Value of Agent-Generated Tests for LLM-Based Software Engineering Agents

Authors: Zhi Chen, Zhensu Sun, Yuling Shi, Chao Peng, Xiaodong Gu, David Lo, Lingxiao Jiang

Organizations: Singapore Management University, Singapore, Singapore · Shanghai Jiao Tong University, Shanghai, China · ByteDance, Beijing, China

Abstract

Large Language Model (LLM) code agents increasingly resolve repository-level issues by iteratively editing code, invoking tools, and validating candidate patches. In these workflows, agents often write tests on the fly, but the value of this behavior remains unclear. This raises a central question: how does agent-written testing relate to task outcomes and resource use during repository-level issue resolution? To better understand the role of agent-written tests, we analyze 5,000 recorded agent runs produced by six strong LLMs on SWE-bench Verified using the lightweight mini-SWE-agent scaffold. Our results show that test writing is common for most models. GPT-5.2 is an exception: it rarely writes new test files while achieving a resolution rate close to the top-ranked model. Test-writing frequency varies widely across models. Within a given model, it differs less between resolved and unresolved tasks. When tests are written, their files contain substantially more statements that print runtime values than assertions that check conditions. We then compare baseline prompts with revised prompts that encourage or discourage writing new test files for four models. Agents start or stop writing test files as requested on 36.8%-93.2% of tasks. Resolved-task totals differ by 0-13 out of 500 per model, with no statistically significant difference, while API calls or token use differ substantially for three models. Similar resolution totals can therefore hide substantial differences in how agents test and how many resources they use.

Figures & tables

Explore similar work

CardsList
  1. AgentForge: Execution-Grounded Multi-Agent LLM Framework for Autonomous Software Engineering

    Apr 13, 2026Rajesh Kumar, Waqar Ali, Junaid Ahmed +2Software Engineering AgentsMulti-Agent Coding

  2. TestJack: Should you trust the results in coding benchmarks? Agentic Coding Benchmarks Auditing via Evaluator Evolution

    Oct 7, 2026Shuangjie Yao, Hao Wang, Koushik Sen +3LLM Agent EvaluationAI Agent Benchmarks