Are Coding Agents Generating Over-Mocked Tests? An Empirical Study
Andre Hora, Romain Robbes

TL;DR
This study investigates the prevalence and characteristics of mocks in tests generated by coding agents across thousands of repositories, revealing that agents tend to modify tests and add mocks more frequently than non-agents, with implications for test quality.
Contribution
First empirical analysis of mock usage in agent-generated tests, highlighting their impact on test maintenance and suggesting guidelines for better mocking practices.
Findings
Coding agents are more likely to modify tests and add mocks than non-agents.
60% of repositories with agent activity also have agent test activity.
36% of agent commits add mocks to tests, higher than non-agent commits.
Abstract
Coding agents have received significant adoption in software development recently. Unlike traditional LLM-based code completion tools, coding agents work with autonomy (e.g., invoking external tools) and leave visible traces in software repositories, such as authoring commits. Among their tasks, coding agents may autonomously generate software tests; however, the quality of these tests remains uncertain. In particular, excessive use of mocking can make tests harder to understand and maintain. This paper presents the first study to investigate the presence of mocks in agent-generated tests of real-world software systems. We analyzed over 1.2 million commits made in 2025 in 2,168 TypeScript, JavaScript, and Python repositories, including 48,563 commits by coding agents, 169,361 commits that modify tests, and 44,900 commits that add mocks to tests. Overall, we find that coding agents are…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Software Engineering Techniques and Practices · Software Engineering Research
