Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Models
Not on the map. Why?
Abstract (arXiv)
Unit testing is essential for software quality assurance, yet writing and maintaining tests remains time-consuming and error-prone. To address this challenge, researchers have proposed various techniques for automating unit test generation, including traditional heuristic-based methods and more recent approaches that leverage large language models (LLMs). However, these existing approaches are inherently path-insensitive because they rely on fixed heuristics or limited contextual information and fail to reason about deep control-flow structures. As a result, they often struggle to achieve adequate coverage, particularly for deep or complex execution paths. In this work, we present a path-sensitive framework, JUnitGenie, to fill this gap by combining code knowledge with the semantic capabilities of LLMs in guiding context-aware unit test generation. After extracting code knowledge from Java projects, JUnitGenie distills this knowledge into structured prompts to guide the generation of high-coverage unit tests. We evaluate JUnitGenie on 2,258 complex focal methods from ten real-world Java projects. The results show that JUnitGenie generates valid tests and improves branch and line coverage by 29.60% and 31.00% on average over both heuristic and LLM-based baselines. We further demonstrate that the generated test cases can uncover real-world bugs, which were later confirmed and fixed by developers.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 31 of its 80 references that are in the map. First posted on arXiv 28 Sep 2025.
Builds on
31 of 80 references.
References · 31
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 841
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 96
- 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
- 2022Pynguin: Automated Unit Test Generation for Pythoncited by 50
- 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
- 2024CoverUp: Effective High Coverage Test Generation for Pythoncited by 38
19 more
- 2024HITS: High-coverage LLM-based Unit Test Generation via Method Slicingcited by 38
- 2016A Survey of Symbolic Execution Techniquescited by 36
- 2023A3Test: Assertion-Augmented Automated Test Case Generationcited by 33
- 2023ChatGPT vs SBST: A Comparative Assessment of Unit Test Suite Generationcited by 32
- 2023Learning Deep Semantics for Test Completioncited by 31
- 2023CAT-LM: Training Language Models on Aligned Code And Testscited by 28
- 2021An Empirical Study of Automated Unit Test Generation for Pythoncited by 10
- 2024Advancing Code Coverage: Incorporating Program Analysis with Large Language Modelscited by 9
- 2025LLM Test Generation via Iterative Hybrid Program Analysiscited by 9
- 2024A Large-scale Investigation of Semantically Incompatible APIs behind Compatibility Issues in Android Appscited by 5
- 2024exLong: Generating Exceptional Behavior Tests with Large Language Modelscited by 4
- 2025Enhancing LLM's Ability to Generate More Repository-Aware Unit Tests Through Precise Contextual Information Injectioncited by 4
- 2022Mining Android API Usage to Generate Unit Test Cases for Pinpointing Compatibility Issuescited by 3
- 2024InterEvo-TR: Interactive Evolutionary Test Generation With Readability Assessmentcited by 3
- 2023Taming Android Fragmentation through Lightweight Crowdsourced Testingcited by 2
- 2024Do Chase Your Tail! Missing Key Aspects Augmentation in Textual Vulnerability Descriptions of Long-tail Software through Feature Inferencecited by 2
- 2025Fixing Outside the Box: Uncovering Tactics for Open-Source Security Issue Managementcited by 2
- 2022Automatically Generating Test Cases for Safety-Critical Software via Symbolic Executioncited by 1
- 2024Automatic Build Repair for Test Cases using Incompatible Java Versionscited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.