39
0

LLM Test Generation via Iterative Hybrid Program Analysis

Abstract

Automating unit test generation remains a significant challenge, particularly for complex methods in real-world projects. While Large Language Models (LLMs) have made strides in code generation, they struggle to achieve high branch coverage due to their limited ability to reason about intricate control flow structures. To address this limitation, we introduce Panta, a technique that emulates the iterative process human developers follow when analyzing code and constructing test cases. Panta integrates static control flow analysis and dynamic code coverage analysis to systematically guide LLMs in identifying uncovered execution paths and generating better test cases. By incorporating an iterative feedback-driven mechanism, our technique continuously refines test generation based on static and dynamic path coverage insights, ensuring more comprehensive and effective testing. Our empirical evaluation, conducted on classes with high cyclomatic complexity from open-source projects, demonstrates that Panta achieves 26% higher line coverage and 23% higher branch coverage compared to the state-of-the-art.

View on arXiv
@article{gu2025_2503.13580,
  title={ LLM Test Generation via Iterative Hybrid Program Analysis },
  author={ Sijia Gu and Noor Nashid and Ali Mesbah },
  journal={arXiv preprint arXiv:2503.13580},
  year={ 2025 }
}
Comments on this paper