mlsanityData to 7 Oct 2026

An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generation

arXiv 2302.06527 ↗First posted 13 Feb 2023cs.SE cs.AIcited by 193

Not on the map. Why?

Cited by 41 in LLM agents and tool use, but placed by its own abstract, which didn’t fit.

Abstract (arXiv)

Unit tests play a key role in ensuring the correctness of software. However, manually creating unit tests is a laborious task, motivating the need for automation. Large Language Models (LLMs) have recently been applied to this problem, utilizing additional training or few-shot learning on examples of existing tests. This paper presents a large-scale empirical evaluation on the effectiveness of LLMs for automated unit test generation without additional training or manual effort, providing the LLM with the signature and implementation of the function under test, along with usage examples extracted from documentation. We also attempt to repair failed generated tests by re-prompting the model with the failing test and error message. We implement our approach in TestPilot, a test generation tool for JavaScript that automatically generates unit tests for all API functions in an npm package. We evaluate TestPilot using OpenAI's gpt3.5-turbo LLM on 25 npm packages with a total of 1,684 API functions. The generated tests achieve a median statement coverage of 70.2% and branch coverage of 52.8%, significantly improving on Nessie, a recent feedback-directed JavaScript test generation technique, which achieves only 51.3% statement coverage and 25.6% branch coverage. We also find that 92.8% of TestPilot's generated tests have no more than 50% similarity with existing tests (as measured by normalized edit distance), with none of them being exact copies. Finally, we run TestPilot with two additional LLMs, OpenAI's older code-cushman-002 LLM and the open LLM StarCoder. Overall, we observed similar results with the former (68.2% median statement coverage), and somewhat worse results with the latter (54.0% median statement coverage), suggesting that the effectiveness of the approach is influenced by the size and training set of the LLM, but does not fundamentally depend on the specific model.

Key facts. Cited by 193 papers in the map (data through 7 Oct 2026). Builds on 23 of its 94 references that are in the map. First posted on arXiv 13 Feb 2023.

Builds on

23 of 94 references.

References · 23

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
  5. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  6. 2021Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigmcited by 599
  7. 2022CodeT: Code Generation with Generated Testscited by 369
  8. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  9. 2017Learning to Represent Programs with Graphscited by 219
  10. 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
  11. 2020Code Prediction by Feeding Trees to Transformerscited by 70
  12. 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
11 more
  1. 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
  2. 2021Self-Supervised Bug Detection and Repaircited by 59
  3. 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
  4. 2020Big Code != Big Vocabulary: Open-Vocabulary Models for Source Codecited by 53
  5. 2022Interactive Code Generation via Test-Driven User-Intent Formalizationcited by 50
  6. 2017Code Completion with Neural Attention and Pointer Networkscited by 49
  7. 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
  8. 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
  9. 2020Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformerscited by 30
  10. 2022Using Transfer Learning for Code-Related Taskscited by 18
  11. 2020Neural Software Analysiscited by 11

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 14; 2024: 56; 2025: 62; 2026: 61.

193 papers.

Sort:

By area:

  1. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
  2. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
  3. 2025SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolutioncited by 246
  4. 2024RepairAgent: An Autonomous, LLM-Based Agent for Program Repaircited by 225
  5. 2024Large Language Model-Based Agents for Software Engineering: A Surveycited by 173
  6. 2024SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agentscited by 129
  7. 2023Keep the Conversation Going: Fixing 162 out of 337 bugs for 0.42 each using ChatGPTcited by 125
  8. 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 63
  9. 2025OpenCodeInstruct: A Large-scale Instruction Tuning Dataset for Code LLMscited by 57
  10. 2025Co-Evolving LLM Coder and Unit Tester via Reinforcement Learningcited by 51
  11. 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
  12. 2024You Name It, I Run It: An LLM Agent to Execute Tests of Arbitrary Projectscited by 45
38 more
  1. 2024Human-In-the-Loop Software Development Agentscited by 42
  2. 2023LLM4EDA: Emerging Progress in Large Language Models for Electronic Design Automationcited by 40
  3. 2024Can LLMs Replace Manual Annotation of Software Engineering Artifacts?cited by 40
  4. 2025A Survey of Research in Large Language Models for Electronic Design Automationcited by 38
  5. 2024CoverUp: Effective High Coverage Test Generation for Pythoncited by 36
  6. 2024SOEN-101: Code Generation by Emulating Software Process Models Using Large Language Model Agentscited by 34
  7. 2024Data-driven Discovery with Large Generative Modelscited by 33
  8. 2024Test-Driven Development for Code Generationcited by 32
  9. 2023Learning Deep Semantics for Test Completioncited by 31
  10. 2024Large Language Models as Test Case Generators: Performance Evaluation and Enhancementcited by 27
  11. 2024MHPP: Exploring the Capabilities and Limitations of Language Models Beyond Basic Code Generationcited by 25
  12. 2025Otter: Generating Tests from Issues to Validate SWE Patchescited by 24
  13. 2024The Future of AI-Driven Software Engineeringcited by 23
  14. 2025Mutation-Guided LLM-based Test Generation at Metacited by 23
  15. 2024The Landscape and Challenges of HPC Research and LLMscited by 22
  16. 2023Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generationcited by 21
  17. 2023LLM4DV: Using Large Language Models for Hardware Test Stimuli Generationcited by 21
  18. 2024Performance-Aligned LLMs for Generating Fast Codecited by 20
  19. 2025Agentic Bug Reproduction for Effective Automated Program Repair at Googlecited by 20
  20. 2024Divide-and-Conquer Meets Consensus: Unleashing the Power of Functions in Code Generationcited by 19
  21. 2025Correctness Assessment of Code Generated by Large Language Models Using Internal Representationscited by 17
  22. 2025Learning to Generate Unit Tests for Automated Debuggingcited by 16
  23. 2026SWE-Universe: Scale Real-World Verifiable Environments to Millionscited by 16
  24. 2023LLM4VV: Developing LLM-Driven Testsuite for Compiler Validationcited by 15
  25. 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
  26. 2023CodeFuse-13B: A Pretrained Multi-lingual Code Large Language Modelcited by 14
  27. 2024LLM-Powered Test Case Generation for Detecting Bugs in Plausible Programscited by 14
  28. 2025CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generationcited by 14
  29. 2025Migrating Code At Scale With LLMs At Googlecited by 14
  30. 2023Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Toolscited by 13
  31. 2024The Impact of Prompt Programming on Function-Level Code Generationcited by 13
  32. 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
  33. 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
  34. 2024LLMs: A Game-Changer for Software Engineers?cited by 11
  35. 2025ClassInvGen: Class Invariant Synthesis using Large Language Modelscited by 11
  36. 2026TrajAudit: Automated Failure Diagnosis for Agentic Coding Systemscited by 11
  37. 2024JavaBench: A Benchmark of Object-Oriented Code Generation for Evaluating Large Language Modelscited by 10
  38. 2024RepoMasterEval: Evaluating Code Completion via Real-World Repositoriescited by 10

50 most cited of 193 All 193 (JSON)