Benchmarking LLMs for Unit Test Generation from Real-World Functions
Not on the map. Why?
Abstract (arXiv)
Recently, large language models (LLMs) have shown great promise in automating unit test generation, significantly reducing the manual effort required by developers. To effectively evaluate the capabilities of LLMs in this domain, it is crucial to have a well-designed benchmark that accurately reflects real-world scenarios and mitigates common pitfalls. Existing LLM test generation benchmarks are limited by two critical drawbacks: data contamination and structurally simple function code. As a result, we often cannot rely on the validity of scientific conclusions drawn from empirical studies using these limited benchmarks. The empirical evidence presented may be biased due to contamination and may fail to generalize beyond toy programs due to structural simplicity. To address these problems, we introduce ULT (UnLeakedTestbench), a new benchmark specifically designed for function-level unit test generation from real-world Python functions. ULT is constructed through a multi-stage curation process that ensures high cyclomatic complexity and mitigates test case contamination. With 3,909 carefully selected function-level tasks, ULT provides a more realistic and challenging evaluation of LLMs' test generation capabilities. We also provide PLT (PreLeakedTestbench), a pair benchmark of ULT with leaked tests designed to enable a controlled analysis of memorization versus reasoning in test generation. Our evaluation results demonstrate that ULT is significantly more challenging. For example, test cases generated by LLMs only achieve 41.32%, 45.10%, 30.22%, and 40.21% for accuracy, statement coverage, branch coverage, and mutation score on average for all LLMs, respectively. These results are substantially lower than the corresponding metrics on TestEval (91.79%, 92.18%, 82.04%, and 49.69%) and PLT (47.07%, 55.13%, 40.07%, and 50.80%).
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). Builds on 24 of its 45 references that are in the map. First posted on arXiv 1 Aug 2025.
Builds on
24 of 45 references.
References · 24
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 399
- 2022CodeT: Code Generation with Generated Testscited by 384
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
- 2024SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agentscited by 133
- 2022Large Language Models are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Modelscited by 103
- 2023Using Large Language Models to Generate JUnit Tests: An Empirical Studycited by 53
- 2024TestGenEval: A Real World Unit Test Generation and Test Completion Benchmarkcited by 52
- 2023Effective Test Generation Using Pre-trained Large Language Models and Mutation Testingcited by 51
12 more
- 2024TESTEVAL: Benchmarking Large Language Models for Test Case Generationcited by 40
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2023WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Modelscited by 37
- 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarkscited by 37
- 2023Large Language Models are Edge-Case Fuzzers: Testing Deep Learning Libraries via FuzzGPTcited by 36
- 2024Mercury: A Code Efficiency Benchmark for Code Large Language Modelscited by 35
- 2024TestART: Improving LLM-based Unit Testing via Co-evolution of Automated Generation and Repair Iterationcited by 20
- 2023KernelGPT: Enhanced Kernel Fuzzing via Large Language Modelscited by 17
- 2024TestBench: Evaluating Class-Level Test Case Generation Capability of Large Language Modelscited by 15
- 2024TestSpark: IntelliJ IDEA's Ultimate Test Generation Companioncited by 9
- 2024Large-scale, Independent and Comprehensive study of the power of LLMs for test case generationcited by 4
- 2025DeCon: Detecting Incorrect Assertions via Postconditions Generated by a Large Language Modelcited by 1
Built on by
Citing papers per year: 2025: 2; 2026: 6.
8 papers.
- 2026Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learningcited by 8
- 2026TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generationcited by 5
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesiscited by 4
- 2025SELF-REDRAFT: Eliciting Intrinsic Exploration-Exploitation Balance in Test-Time Scaling for Code Generationcited by 1
- 2026Ockhamareto: Pareto-Gated Segment-Level Credit Assignment for Concise Unit-Test Generation with Reinforcement Learningcited by 1
- 2026SWE-Spot: Building Small Repo-Experts with Repository-Centric Learningcited by 0
- 2026Mastermind: Strategy-grounded Learning for Repository-Scale Vulnerability Reproductioncited by 0
- 2026Answer Probing-Guided Search for Diverse Solution Exploration of LLMscited by 0
- 2026Answer Probing-Guided Search for Diverse Solution Exploration of LLMs31 Aug 2026
- 2026Ockhamareto: Pareto-Gated Segment-Level Credit Assignment for Concise Unit-Test Generation with Reinforcement Learning25 Aug 2026
- 2026Mastermind: Strategy-grounded Learning for Repository-Scale Vulnerability Reproduction2 Jul 2026
- 2026Code-A1: Adversarial Evolving of Code LLM and Test LLM via Reinforcement Learning16 Mar 2026
- 2026TestExplora: Benchmarking LLMs for Proactive Bug Discovery via Repository-Level Test Generation11 Feb 2026
- 2026SWE-Spot: Building Small Repo-Experts with Repository-Centric Learning29 Jan 2026
- 2025SELF-REDRAFT: Eliciting Intrinsic Exploration-Exploitation Balance in Test-Time Scaling for Code Generation31 Oct 2025
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesis30 Oct 2025