← Latest papers
💻 computer science

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

This paper challenges the assumed value of agent-generated tests in LLM-based software engineering by demonstrating that while such tests are frequently written, they primarily serve as observational feedback rather than rigorous validation, and manipulating their volume through prompt interventions does not significantly impact final issue-resolution outcomes.

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

Published 2026-04-10
📖 4 min read☕ Coffee break read

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

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are hiring a team of super-smart, AI-powered mechanics to fix a complex, broken car engine (which represents a bug in a software codebase).

For a long time, the industry belief has been: "To fix the car well, the mechanic must first write a detailed checklist and run a bunch of diagnostic tests." The logic is that if the mechanic writes a test, they are being thorough, and the car will definitely be fixed.

This paper asks a simple, provocative question: "Is writing all those tests actually helping the mechanic fix the car, or are they just wasting time and gas?"

Here is the breakdown of what the researchers found, using some everyday analogies.

1. The "Over-Preparer" vs. The "Gut-Feeler"

The researchers watched six different AI "mechanics" (Large Language Models) try to fix 500 different software problems.

  • The Over-Preparer (e.g., Claude Opus 4.5): This AI wrote new test files in 83% of the tasks. It was constantly stopping to write checklists, run diagnostics, and double-check its work.
  • The Gut-Feeler (e.g., GPT-5.2): This AI almost never wrote new tests (only 0.6% of the time). It just looked at the problem, thought hard, and started fixing it.

The Shocking Result: Both mechanics fixed roughly the same number of cars (about 72–74%). The one who wrote all the tests didn't do a better job than the one who didn't. In fact, the "Gut-Feeler" saved a massive amount of time and money by skipping the paperwork.

2. What Were the "Tests" Actually Doing?

The researchers looked closely at the tests the AI wrote. They expected to see strict "Pass/Fail" checklists (like: "If the engine makes a noise, the test fails").

Instead, they found the AI was mostly using tests as a flashlight, not a judge.

  • The Analogy: Imagine a mechanic shining a flashlight on a part of the engine and saying, "Hey, this bolt is loose," or "The oil pressure is 40 psi."
  • The Reality: The AI wrote mostly "print statements" (shining the flashlight) to see what was happening inside the code. It rarely wrote strict "assertions" (the actual pass/fail rules). It was using the tests to observe the code, not to judge if the fix was perfect.

3. The "Prompt Experiment"

To be sure, the researchers played a trick on the AI. They changed the instructions (the "prompt") given to the AI:

  • Group A: "Please write as many tests as possible!"
  • Group B: "Do not write any new tests; just fix the bug."

The Results:

  • Did the success rate change? No. Forcing the AI to write tests didn't make it fix more bugs. Stopping it from writing tests didn't make it fix fewer bugs. The final outcome was almost identical.
  • Did the cost change? Huge.
    • When they forced the AI to write tests, it burned through 20% more computer power (tokens) and made more phone calls (API calls) to the server.
    • When they told the AI not to write tests, it saved a massive amount of money and time, with almost no drop in quality.

The Big Takeaway: "Habit vs. Strategy"

The paper concludes that for these AI agents, writing tests has become a habit, not a strategy.

Think of it like a student taking a math exam.

  • The Old Way: The student thinks, "I must show my work on a separate sheet of paper to prove I'm smart."
  • The Reality: The student is actually just scribbling notes to help themselves think, but the separate sheet isn't actually helping them get the right answer faster. In fact, writing that extra sheet is just slowing them down and using up their exam time.

What this means for the future:

  1. Don't force the AI to write tests. If you tell an AI to "write tests," it might just waste your money without fixing the problem any better.
  2. Focus on the "Flashlight." The AI is good at using tests to look at the code (observation). We need to teach it how to use tests to judge the code (strict validation).
  3. Save the budget. If you are building software with AI, you can probably cut out the "write a test first" step and save a lot of money, as long as you have other ways to check if the fix works.

In short: Just because an AI is writing a test doesn't mean it's doing a better job. Sometimes, it's just filling out paperwork while the real work gets done elsewhere.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →