Using Large Language Models to Generate JUnit Tests: An Empirical Study
Not on the map. Why?
Abstract (arXiv)
A code generation model generates code by taking a prompt from a code comment, existing code, or a combination of both. Although code generation models (e.g., GitHub Copilot) are increasingly being adopted in practice, it is unclear whether they can successfully be used for unit test generation without fine-tuning for a strongly typed language like Java. To fill this gap, we investigated how well three models (Codex, GPT-3.5-Turbo, and StarCoder) can generate unit tests. We used two benchmarks (HumanEval and Evosuite SF110) to investigate the effect of context generation on the unit test generation process. We evaluated the models based on compilation rates, test correctness, test coverage, and test smells. We found that the Codex model achieved above 80% coverage for the HumanEval dataset, but no model had more than 2% coverage for the EvoSuite SF110 benchmark. The generated tests also suffered from test smells, such as Duplicated Asserts and Empty Tests.
Key facts. Cited by 53 papers in the map (data through 14 Oct 2026). Builds on 17 of its 74 references that are in the map. First posted on arXiv 30 Apr 2023.
Builds on
17 of 74 references.
References · 17
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2022CodeT: Code Generation with Generated Testscited by 384
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 221
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2022Productivity Assessment of Neural Code Completioncited by 98
- 2020Code Prediction by Feeding Trees to Transformerscited by 70
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequencescited by 50
5 more
- 2020Fast and Memory-Efficient Neural Code Completioncited by 38
- 2023Nuances are the Key: Unlocking ChatGPT to Find Failure-Inducing Tests with Differential Promptingcited by 23
- 2022M2TS: Multi-Scale Multi-Modal Approach Based on Transformer for Source Code Summarizationcited by 14
- 2022On the Effectiveness of Pretrained Models for API Learningcited by 9
- 2017A Large-Scale Study on the Usage of Testing Patterns that Address Maintainability Attributes (Patterns for Ease of Modification, Diagnoses, and Comprehension)cited by 7
Built on by
Citing papers per year: 2023: 4; 2024: 14; 2025: 23; 2026: 12.
53 papers.
Sort:
By area:
- 2024The Limits of Inference Scaling Through Resamplingcited by 53
- 2023SALLM: Security Assessment of Generated Codecited by 39
- 2024The Future of AI-Driven Software Engineeringcited by 23
- 2023FRANC: A Lightweight Framework for High-Quality Code Generationcited by 14
- 2025CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generationcited by 14
- 2025Migrating Code At Scale With LLMs At Googlecited by 14
- 2025Metamorphic Testing of Large Language Models for Natural Language Processingcited by 12
- 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
- 2024The Fault in our Stars: Quality Assessment of Code Generation Benchmarkscited by 9
- 2025Do LLMs Consider Security? An Empirical Study on Responses to Programming Questionscited by 9
- 2025PromptPex: Automatic Test Generation for Language Model Promptscited by 9
- 2025LLM Test Generation via Iterative Hybrid Program Analysiscited by 9
38 more
- 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generationcited by 9
- 2024A System for Automated Unit Test Generation Using Large Language Models and Assessment of Generated Test Suitescited by 8
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functionscited by 8
- 2026Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generationcited by 7
- 2024Automating Autograding: Large Language Models as Test Suite Generators for Introductory Programmingcited by 6
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-benchcited by 5
- 2024exLong: Generating Exceptional Behavior Tests with Large Language Modelscited by 4
- 2025MultiFileTest: A Multi-File-Level LLM Unit Test Generation Benchmark and Impact of Error Fixing Mechanismscited by 4
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 4
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesiscited by 4
- 2023Exploring the Potential of Large Language Models in Generating Code-Tracing Questions for Introductory Programming Coursescited by 3
- 2024Parameter-Efficient Fine-Tuning of Large Language Models for Unit Test Generation: An Empirical Studycited by 3
- 2025SURGE: On the Potential of Large Language Models as General-Purpose Surrogate Code Executorscited by 3
- 2025On Simulation-Guided LLM-based Code Generation for Safe Autonomous Driving Softwarecited by 3
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsificationcited by 2
- 2024Forklift: An Extensible Neural Liftercited by 2
- 2024Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learningcited by 2
- 2024Evaluation of the Programming Skills of Large Language Modelscited by 2
- 2024Exploring the Integration of Large Language Models in Industrial Test Maintenance Processescited by 2
- 2025An Analysis of LLM Fine-Tuning and Few-Shot Learning for Flaky Test Detection and Classificationcited by 2
- 2025QiMeng-MuPa: Mutual-Supervised Learning for Sequential-to-Parallel Code Translationcited by 2
- 2025Large Language Models for Software Testing: A Research Roadmapcited by 2
- 2024On the Effectiveness of LLMs for Manual Test Verificationscited by 1
- 2025A Systematic Approach for Assessing Large Language Models' Test Case Generation Capabilitycited by 1
- 2025Large Language Models in Code Co-generation for Safe Autonomous Vehiclescited by 1
- 2025LLMs for Automated Unit Test Generation and Assessment in Java: The AgoneTest Frameworkcited by 1
- 2026Configuration Smells in AGENTS.md Files: Common Mistakes in Configuring Coding Agentscited by 1
- 2026MANGO: Automated Multi-Agent Test Oracle Generation for Vision-Language-Action Modelscited by 1
- 2026SCATE: Learning to Supervise Coding Agents for Cost-Effective Test Generationcited by 1
- 2026Ockhamareto: Pareto-Gated Segment-Level Credit Assignment for Concise Unit-Test Generation with Reinforcement Learningcited by 1
- 2023Breaking the Silence: the Threats of Using LLMs in Software Engineeringcited by 0
- 2025CUBETESTERAI: Automated JUnit Test Generation using the LLaMA Modelcited by 0
- 2025Evaluating Large Language Models for the Generation of Unit Tests with Equivalence Partitions and Boundary Valuescited by 0
- 2025iPanda: An LLM-based Agent for Automated Conformance Testing of Communication Protocolscited by 0
- 2026Enhancing Large Language Models with Retrieval Augmented Generation for Software Testing and Inspection Automationcited by 0
- 2026Program Structure-aware Language Models: Targeted Software Testing beyond Textual Semanticscited by 0
- 2026Fail-Aware and Explainable Test Oracle Predictioncited by 0
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requestscited by 0
50 most cited of 53 All 53 (JSON)
- 2026VibeCheck: Assessing the Quality of LLM-Generated Unit Tests: A Multi-agent Empirical Study across Heterogeneous Repositories5 Sep 2026
- 2026Ockhamareto: Pareto-Gated Segment-Level Credit Assignment for Concise Unit-Test Generation with Reinforcement Learning25 Aug 2026
- 2026Evaluating and Mitigating the Misguidance Effect of Buggy Code in LLM-Generated Unit Tests24 Jul 2026
- 2026Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)24 Jul 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026Fail-Aware and Explainable Test Oracle Prediction13 Jul 2026
- 2026SCATE: Learning to Supervise Coding Agents for Cost-Effective Test Generation9 Jul 2026
- 2026MANGO: Automated Multi-Agent Test Oracle Generation for Vision-Language-Action Models23 Jun 2026
- 2026Configuration Smells in AGENTS.md Files: Common Mistakes in Configuring Coding Agents14 Jun 2026
- 2026Program Structure-aware Language Models: Targeted Software Testing beyond Textual Semantics20 Apr 2026
- 2026Enhancing Large Language Models with Retrieval Augmented Generation for Software Testing and Inspection Automation16 Apr 2026
- 2026Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generation8 Feb 2026
38 more
- 2025LLMs for Automated Unit Test Generation and Assessment in Java: The AgoneTest Framework25 Nov 2025
- 2025Metamorphic Testing of Large Language Models for Natural Language Processing3 Nov 2025
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesis30 Oct 2025
- 2025Large Language Models for Software Testing: A Research Roadmap29 Sep 2025
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functions1 Aug 2025
- 2025iPanda: An LLM-based Agent for Automated Conformance Testing of Communication Protocols1 Jul 2025
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-bench30 Jun 2025
- 2025QiMeng-MuPa: Mutual-Supervised Learning for Sequential-to-Parallel Code Translation11 Jun 2025
- 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generation3 Jun 2025
- 2025Large Language Models in Code Co-generation for Safe Autonomous Vehicles26 May 2025
- 2025Evaluating Large Language Models for the Generation of Unit Tests with Equivalence Partitions and Boundary Values14 May 2025
- 2025Migrating Code At Scale With LLMs At Google13 Apr 2025
- 2025On Simulation-Guided LLM-based Code Generation for Safe Autonomous Driving Software2 Apr 2025
- 2025LLM Test Generation via Iterative Hybrid Program Analysis17 Mar 2025
- 2025CUBETESTERAI: Automated JUnit Test Generation using the LLaMA Model13 Mar 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2025PromptPex: Automatic Test Generation for Language Model Prompts7 Mar 2025
- 2025Do LLMs Consider Security? An Empirical Study on Responses to Programming Questions20 Feb 2025
- 2025SURGE: On the Potential of Large Language Models as General-Purpose Surrogate Code Executors16 Feb 2025
- 2025CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generation15 Feb 2025
- 2025MultiFileTest: A Multi-File-Level LLM Unit Test Generation Benchmark and Impact of Error Fixing Mechanisms10 Feb 2025
- 2025A Systematic Approach for Assessing Large Language Models' Test Case Generation Capability5 Feb 2025
- 2025An Analysis of LLM Fine-Tuning and Few-Shot Learning for Flaky Test Detection and Classification4 Feb 2025
- 2024The Limits of Inference Scaling Through Resampling26 Nov 2024
- 2024Automating Autograding: Large Language Models as Test Suite Generators for Introductory Programming14 Nov 2024
- 2024Parameter-Efficient Fine-Tuning of Large Language Models for Unit Test Generation: An Empirical Study4 Nov 2024
- 2024On the Effectiveness of LLMs for Manual Test Verifications19 Sep 2024
- 2024Exploring the Integration of Large Language Models in Industrial Test Maintenance Processes10 Sep 2024
- 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Tests21 Aug 2024
- 2024A System for Automated Unit Test Generation Using Large Language Models and Assessment of Generated Test Suites14 Aug 2024
- 2024The Future of AI-Driven Software Engineering11 Jun 2024
- 2024exLong: Generating Exceptional Behavior Tests with Large Language Models23 May 2024
- 2024Evaluation of the Programming Skills of Large Language Models23 May 2024
- 2024Are Human Rules Necessary? Generating Reusable APIs with CoT Reasoning and In-Context Learning6 May 2024
- 2024The Fault in our Stars: Quality Assessment of Code Generation Benchmarks15 Apr 2024
- 2024Generative transformations and patterns in LLM-native approaches for software verification and falsification14 Apr 2024
- 2024Forklift: An Extensible Neural Lifter1 Apr 2024
- 2023Breaking the Silence: the Threats of Using LLMs in Software Engineering13 Dec 2023
50 newest of 53 All 53 (JSON)
- 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generationcited by 9
- 2026Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generationcited by 7
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-benchcited by 5
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesiscited by 4
- 2026Configuration Smells in AGENTS.md Files: Common Mistakes in Configuring Coding Agentscited by 1
- 2026SCATE: Learning to Supervise Coding Agents for Cost-Effective Test Generationcited by 1
- 2025iPanda: An LLM-based Agent for Automated Conformance Testing of Communication Protocolscited by 0
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requestscited by 0
- 2026VibeCheck: Assessing the Quality of LLM-Generated Unit Tests: A Multi-agent Empirical Study across Heterogeneous Repositoriescited by 0
- 2026VibeCheck: Assessing the Quality of LLM-Generated Unit Tests: A Multi-agent Empirical Study across Heterogeneous Repositories5 Sep 2026
- 2026How Do AI Coding Agents Contribute to Software Development? an Empirical Study of Agentic Pull Requests23 Jul 2026
- 2026SCATE: Learning to Supervise Coding Agents for Cost-Effective Test Generation9 Jul 2026
- 2026Configuration Smells in AGENTS.md Files: Common Mistakes in Configuring Coding Agents14 Jun 2026
- 2026Test vs Mutant: Adversarial LLM Agents for Robust Unit Test Generation8 Feb 2026
- 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesis30 Oct 2025
- 2025iPanda: An LLM-based Agent for Automated Conformance Testing of Communication Protocols1 Jul 2025
- 2025How Safe Are AI-Generated Patches? A Large-scale Study on Security Risks in LLM and Agentic Automated Program Repair on SWE-bench30 Jun 2025
- 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generation3 Jun 2025
- 2024The Limits of Inference Scaling Through Resamplingcited by 53
- 2023SALLM: Security Assessment of Generated Codecited by 39
- 2024The Future of AI-Driven Software Engineeringcited by 23
- 2023FRANC: A Lightweight Framework for High-Quality Code Generationcited by 14
- 2025CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generationcited by 14
- 2025Migrating Code At Scale With LLMs At Googlecited by 14
- 2025Metamorphic Testing of Large Language Models for Natural Language Processingcited by 12
- 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
- 2024The Fault in our Stars: Quality Assessment of Code Generation Benchmarkscited by 9
- 2025Do LLMs Consider Security? An Empirical Study on Responses to Programming Questionscited by 9
- 2025PromptPex: Automatic Test Generation for Language Model Promptscited by 9
- 2025LLM Test Generation via Iterative Hybrid Program Analysiscited by 9
12 most cited of 38 All 38 (JSON)
- 2026Evaluating and Mitigating the Misguidance Effect of Buggy Code in LLM-Generated Unit Tests24 Jul 2026
- 2026Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)24 Jul 2026
- 2026Fail-Aware and Explainable Test Oracle Prediction13 Jul 2026
- 2026Program Structure-aware Language Models: Targeted Software Testing beyond Textual Semantics20 Apr 2026
- 2025LLMs for Automated Unit Test Generation and Assessment in Java: The AgoneTest Framework25 Nov 2025
- 2025Metamorphic Testing of Large Language Models for Natural Language Processing3 Nov 2025
- 2025Large Language Models for Software Testing: A Research Roadmap29 Sep 2025
- 2025Benchmarking LLMs for Unit Test Generation from Real-World Functions1 Aug 2025
- 2025QiMeng-MuPa: Mutual-Supervised Learning for Sequential-to-Parallel Code Translation11 Jun 2025
- 2025Evaluating Large Language Models for the Generation of Unit Tests with Equivalence Partitions and Boundary Values14 May 2025
- 2025Migrating Code At Scale With LLMs At Google13 Apr 2025
- 2025LLM Test Generation via Iterative Hybrid Program Analysis17 Mar 2025
12 newest of 38 All 38 (JSON)