Advancing Code Coverage: Incorporating Program Analysis with Large Language Models
Top Cited Papers
Open Access
- 24 April 2026
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Software Engineering and Methodology
- Vol. 35 (5) , 1-31
Abstract
Automatic test generation plays a critical role in software quality assurance. While the recent advances in Search-Based Software Testing (SBST) and Large Language Models (LLMs) have shown promise in generating useful tests, these techniques still struggle to cover certain branches. Reaching these hard-to-cover branches usually requires constructing complex objects and resolving intricate inter-procedural dependencies in branch conditions, which poses significant challenges for existing techniques. In this work, we propose TELPA, a novel technique aimed at addressing these challenges. Its key insight lies in extracting real usage scenarios of the target method under test to learn how to construct complex objects and extracting methods entailing inter-procedural dependencies with hard-to-cover branches to learn the semantics of branch constraints. To enhance efficiency and effectiveness, TELPA identifies a set of ineffective tests as counter-examples for LLMs and employs a feedback-based process to iteratively refine these counter-examples. Then, TELPA integrates program analysis results and counter-examples into the prompt, guiding LLMs to gain deeper understandings of the semantics of the target method and generate diverse tests that can reach the hard-to-cover branches. Our experimental results on 27 open-source Python projects demonstrate that TELPA significantly outperforms the state-of-the-art SBST and LLM-enhanced techniques, achieving an average improvement of 34.10% and 25.93% in terms of branch coverage.Keywords
Funding Information
- National Natural Science Foundation of China (62322208 and 62232001)
- Huawei Fund
This publication has 37 references indexed in Scilit:
- Robustness evaluation of code generation systems via concretizing instructionsInformation and Software Technology, 2024
- CAT-LM Training Language Models on Aligned Code And Tests2023
- CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models2023
- PyCG: Practical Call Graph Generation in Python2021
- Test suite generation with the Many Independent Objective (MIO) algorithmInformation and Software Technology, 2018
- Many Independent Objective (MIO) Algorithm for Test Suite Generation2017
- Automated Test Case Generation as a Many-Objective Optimisation Problem with Dynamic Selection of the TargetsIEEE Transactions on Software Engineering, 2017
- Bidirectional Symbolic Analysis for Effective Branch TestingIEEE Transactions on Software Engineering, 2015
- A practical guide for using statistical tests to assess randomized algorithms in software engineering2011
- Use of Ranks in One-Criterion Variance AnalysisJournal of the American Statistical Association, 1952