mlsanityData to 7 Oct 2026

Large Language Models as Test Case Generators: Performance Evaluation and Enhancement

arXiv 2404.13340 ↗First posted 20 Apr 2024cs.SE cs.AIcited by 27

Not on the map. Why?

Abstract (arXiv)

Code generation with Large Language Models (LLMs) has been extensively studied and achieved remarkable progress. As a complementary aspect to code generation, test case generation is of crucial importance in ensuring the quality and reliability of code. However, using LLMs as test case generators has been much less explored. Current research along this line primarily focuses on enhancing code generation with assistance from test cases generated by LLMs, while the performance of LLMs in test case generation alone has not been comprehensively examined. To bridge this gap, we conduct extensive experiments to study how well LLMs can generate high-quality test cases. We find that as the problem difficulty increases, state-of-the-art LLMs struggle to generate correct test cases, largely due to their inherent limitations in computation and reasoning. To mitigate this issue, we further propose a multi-agent framework called TestChain that decouples the generation of test inputs and test outputs. Notably, TestChain uses a ReAct format conversation chain for LLMs to interact with a Python interpreter in order to provide more accurate test outputs. Our results indicate that TestChain outperforms the baseline by a large margin. Particularly, in terms of the accuracy of test cases, TestChain using GPT-4 as the backbone achieves a 13.84% improvement over the baseline on the LeetCode-hard dataset.

Key facts. Cited by 27 papers in the map (data through 7 Oct 2026). Builds on 17 of its 25 references that are in the map. First posted on arXiv 20 Apr 2024.

Builds on

17 of 25 references.

References · 17

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
  5. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  6. 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,722
  7. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  8. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  9. 2023StarCoder: may the source be with you!cited by 790
  10. 2022CodeT: Code Generation with Generated Testscited by 369
  11. 2023Mathematical Capabilities of ChatGPTcited by 263
  12. 2023Self-collaboration Code Generation via ChatGPTcited by 255
5 more
  1. 2023Evaluating the Logical Reasoning Ability of ChatGPT and GPT-4cited by 202
  2. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
  3. 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
  4. 2022Large Language Models are Few-shot Testers: Exploring LLM-based General Bug Reproductioncited by 110
  5. 2023Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inferencecited by 40

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 4; 2025: 15; 2026: 8.

27 papers.

Sort:

By area:

  1. 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Futurecited by 85
  2. 2024CodeJudge-Eval: Can Large Language Models be Good Judges in Code Understanding?cited by 29
  3. 2025Don't Judge Code by Its Cover: Exploring Biases in LLM Judges for Code Evaluationcited by 18
  4. 2025CoCoEvo: Co-Evolution of Programs and Test Cases to Enhance Code Generationcited by 14
  5. 2025Rethinking Verification for LLM Code Generation: From Generation to Testingcited by 12
  6. 2024Measuring the Influence of Incorrect Code on Test Generationcited by 9
  7. 2025Scoring Verifiers: Evaluating Synthetic Verification for Code and Reasoningcited by 8
  8. 2025G-Sim: Generative Simulations with Large Language Models and Gradient-Free Calibrationcited by 8
  9. 2025Large Language Model Guided Self-Debugging Code Generationcited by 7
  10. 2025HoarePrompt: Structural Reasoning About Program Correctness in Natural Languagecited by 7
  11. 2025Can Language Models Falsify? Evaluating Algorithmic Reasoning with Counterexample Creationcited by 5
  12. 2026SEMAG: Self-Evolutionary Multi-Agent Code Generationcited by 5
15 more
  1. 2025Past, Present, and Future of Bug Tracking in the Generative AI Eracited by 4
  2. 2026Environment-Aware Code Generation: How far are We?cited by 4
  3. 2024Toward Automated Validation of Language Model Synthesized Test Cases using Semantic Entropycited by 3
  4. 2025PBEBench: A Multi-Step Programming by Examples Reasoning Benchmark inspired by Historical Linguisticscited by 2
  5. 2025QiMeng-MuPa: Mutual-Supervised Learning for Sequential-to-Parallel Code Translationcited by 2
  6. 2025Leveraging Generative AI for Enhancing Automated Assessment in Programming Education Contestscited by 1
  7. 2025Refining Critical Thinking in LLM Code Generation: A Faulty Premise-based Evaluation Frameworkcited by 1
  8. 2026Self-Improving Code Generation via Semantic Entropy and Behavioral Consensuscited by 1
  9. 2026Two-Stage Reinforcement Learning for Sound and Adversarial Test Generation in Code LLMscited by 1
  10. 2025AutoTestForge: A Multidimensional Automated Testing Framework for Natural Language Processing Modelscited by 0
  11. 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMscited by 0
  12. 2026DuET: Dual Execution for Test Output Prediction with Generated Code and Pseudocodecited by 0
  13. 2026Enhancing Large Language Models with Retrieval Augmented Generation for Software Testing and Inspection Automationcited by 0
  14. 2026MineValiCoder: Reliable Code Generation with Test Case Quality Mining and Bipartite Graph-Based Mutual Validationcited by 0
  15. 2026Robust Code RL via Faulty-Code-Driven Test case Synthesis and Dense Reward Shapingcited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2025Can LLMs Generate Reliable Test Case Generators? A Study on Competition-Level Programming Problems
  2. 2025Challenges in Testing Large Language Model Based Software: A Faceted Taxonomy
  3. 2024SWT-Bench: Testing and Validating Real-World Bug-Fixes with Code Agents
  4. 2025Towards Advancing Code Generation with Large Language Models: A Research Roadmap
  5. 2026Consistency Meets Verification: Enhancing Test Generation Quality in Large Language Models Without Ground-Truth Solutions
  6. 2025UTBoost: Rigorous Evaluation of Coding Agents on SWE-Bench
  7. 2026TDD-Agent: Test-Driven Reasoning for Code Generation
  8. 2026Test-Oriented Programming: rethinking coding for the GenAI era