JUnitGenie: A Framework for Path-Sensitive Unit Test Generation with Large Language Models
Open Access
- 12 April 2026
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 34-37
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 techniques for automating unit test generation, including heuristic-based methods and more recent approaches that leverage large language models (LLMs). However, these approaches are inherently path-insensitive because they rely on fixed heuristics or limited contextual information and fail to reason about deep control-flow structures, which leads to inadequate coverage, especially for deep execution paths. JUnitGenie extracts code knowledge from Java projects, distills it into structured prompts, and guides LLMs to generate high-coverage tests. We evaluate JUnitGenie on 2,258 complex focal methods from ten real-world Java projects. Results show that JUnitGenie improves branch coverage by an average of 29.60% and line coverage by 31.00% over both heuristic and LLM-based baselines, and generalizes effectively across both closed- and open-source foundation models. JUnitGenie is available at https://github.com/Dianshu-Liao/JUnitGenie-ICSE-Demo, and the demo video is available at https://www.youtube.com/watch?v=-jWJaf661mw.Keywords
This publication has 12 references indexed in Scilit:
- HITS: High-coverage LLM-based Unit Test Generation via Method Slicing2024
- A3-CodGen: A Repository-Level Code Generation Framework for Code Reuse With Local-Aware, Global-Aware, and Third-Party-Library-AwareIEEE Transactions on Software Engineering, 2024
- Evaluating and Improving ChatGPT for Unit Test GenerationProceedings of the ACM on Software Engineering, 2024
- Code-Aware Prompting: A Study of Coverage-Guided Test Generation in Regression Setting using LLMProceedings of the ACM on Software Engineering, 2024
- ChatUniTest: A Framework for LLM-Based Test Generation2024
- SootUp: A Redesign of the Soot Static Analysis Framework2024
- Mining Android API Usage to Generate Unit Test Cases for Pinpointing Compatibility Issues2022
- Defects4J: a database of existing faults to enable controlled testing studies for Java programs2014
- EvoSuite2011
- Randoop2007