PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
October 20, 20251 citationsOpen Access

Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language Models

View Full Paper
DLDan LiaoXYXin YinSPShidong Pan

Key Points

  • JUnitGenie generates unit tests, improving branch and line coverage by an average of 29.60% and 31.00%.
  • With 2,258 complex methods evaluated, JUnitGenie showcases its effectiveness in enhancing software quality.
  • The framework marries code knowledge extraction with large language models to enhance test generation accuracy.
  • JUnitGenie successfully uncovers real-world bugs that were subsequently confirmed and fixed by developers.

Abstract

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.

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Liao et al. (2025) studied this question.

synapsesocial.com/papers/68f64fbb2509bc8625bfb208https://doi.org/10.48550/arxiv.2509.23812
Ask AI
Helpful
Bookmark
Share
View Full Paper

Also Consider

Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context:

  1. 1A System for Automated Unit Test Generation Using Large Language Models and Assessment of Generated Test Suites2024
  2. 2Enhancing Automated Unit Test Generation with Large Language Models: A Systematic Literature Review2026 · 1 citations
  3. 3Fusing LLMs and Genetic Algorithm for High-Quality Unit Test Generation2026
  4. 4A Logic-Guided and Explainable Approach to LLM-Based Unit Test Generation2026 · 2 citations
  5. 5Unit Test Generation Using Large Language Models: A Systematic Literature Review2024 · 6 citations