exLong: Generating Exceptional Behavior Tests with Large Language Models
Not on the map. Why?
Abstract (arXiv)
Many popular programming languages, including C#, Java, and Python, support exceptions. Exceptions are thrown during program execution if an unwanted event happens, e.g., a method is invoked with an illegal argument value. Software developers write exceptional behavior tests (EBTs) to check that their code detects unwanted events and throws appropriate exceptions. Prior research studies have shown the importance of EBTs, but those studies also highlighted that developers put most of their efforts on "happy paths", e.g., paths without unwanted events. To help developers fill the gap, we present the first framework, dubbed exLong, that automatically generates EBTs. exLong is a large language model instruction fine-tuned from CodeLlama and embeds reasoning about traces that lead to throw statements, conditional expressions that guard throw statements, and non-exceptional behavior tests that execute similar traces. We compare exLong with the state-of-the-art models for test generation (CAT-LM) and one of the strongest foundation models (GPT-4o), as well as with analysis-based tools for test generation (Randoop and EvoSuite). Our results show that exLong outperforms existing models and tools. Furthermore, we contributed several pull requests to open-source projects and 23 EBTs generated by exLong were already accepted.
Key facts. Cited by 4 papers in the map (data through 13 Oct 2026). Builds on 28 of its 69 references that are in the map. First posted on arXiv 23 May 2024.
Builds on
28 of 69 references.
References · 28
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,231
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,765
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,693
- 2023Code Llama: Open Foundation Models for Codecited by 2,130
- 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,468
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 884
- 2023StarCoder: may the source be with you!cited by 797
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 651
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 475
- 2020IntelliCode Compose: Code Generation Using Transformercited by 227
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 184
16 more
- 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 164
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2023No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generationcited by 82
- 2024Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLMcited by 64
- 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
- 2023Using Large Language Models to Generate JUnit Tests: An Empirical Studycited by 53
- 2023LLaMA-Reviewer: Advancing Code Review Automation with Large Language Models through Parameter-Efficient Fine-Tuningcited by 47
- 2022CoditT5: Pretraining for Source Code and Natural Language Editingcited by 45
- 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
- 2020Learning to Update Natural Language Comments Based on Code Changescited by 31
- 2023Learning Deep Semantics for Test Completioncited by 31
- 2020Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformerscited by 30
- 2023CAT-LM: Training Language Models on Aligned Code And Testscited by 28
- 2023Multilingual Code Co-Evolution Using Large Language Modelscited by 9
- 2021Using Relative Lines of Code to Guide Automated Test Generation for Pythoncited by 3
- 2021Assessing Exception Handling Testing Practices in Open-Source Librariescited by 2
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2025Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Modelscited by 1
- 2026Multimodal QUD: Inquisitive Questions from Scientific Figurescited by 0
- 2026STAB: Specification-driven Testing for Algorithmic Bottleneckscited by 0
- 2026Retrofitting Code Using LLMs to Support Exceptional Behaviorcited by 0
- 2026Retrofitting Code Using LLMs to Support Exceptional Behavior9 Sep 2026
- 2026STAB: Specification-driven Testing for Algorithmic Bottlenecks27 May 2026
- 2026Multimodal QUD: Inquisitive Questions from Scientific Figures26 Apr 2026
- 2025Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Models28 Sep 2025