LLM vs. Human Unit Tests: Fault Detection on Real Python Bugs
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) have shown considerable promise for automated unit test generation, yet their practical effectiveness relative to human-written tests remains poorly understood. Existing evaluations commonly rely on coverage-oriented benchmarks that do not assess fault-detection capability directly. We present an empirical comparison of LLM-generated and human-written unit tests across three complementary Python benchmarks: 29 real historical bugs from BugsInPy, a function-level benchmark drawn from python-slugify and packaging, and a controlled paired benchmark. Our generation pipeline couples Gemini 2.5 Flash with a lightweight lexical retrieval mechanism that supplies bug-relevant context at generation time. Across eight quality dimensions, LLM-generated tests with retrieval-augmented context detect faults in 69% of cases compared to 17.2% for general-purpose human-written tests (Fisher's exact, p < 0.001, Cohen's h = 1.10). Critically, line and branch coverage are nearly identical between the two approaches (84.8% vs. 88.5% and 75.2% vs. 82.1%), confirming that coverage is an insufficient proxy for fault-detection capability. We discuss the conditions under which each approach excels, characterize their complementary strengths, and identify the critical role of retrieval context and reproducible benchmark construction in meaningful test-quality evaluation.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). First posted on arXiv 7 Jun 2026.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2024Large Language Models as Test Case Generators: Performance Evaluation and Enhancement
- 2024Large-scale, Independent and Comprehensive study of the power of LLMs for test case generation
- 2025Learning to Generate Unit Tests for Automated Debugging
- 2025Test Case Generation from Bug Reports via Large Language Models: A Cognitive Layered Evaluation Framework
- 2026LLMs taking shortcuts in test generation: A study with SAP HANA and LevelDB
- 2025Can LLMs Generate Reliable Test Case Generators? A Study on Competition-Level Programming Problems
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenance
- 2025Challenges in Testing Large Language Model Based Software: A Faceted Taxonomy