Journals
  Publication Years
  Keywords
Search within results Open Search
Please wait a minute...
For Selected: Toggle Thumbnails
Unit test case generation method based on path guidance and iterative optimization
Yukun DONG, Xiaoshan LIU, Shuai LIU, Xinran MENG, Yunhao WEN
Journal of Computer Applications    2026, 46 (11): 3598-3606.   DOI: 10.11772/j.issn.1001-9081.2025091177
Abstract (151)   HTML (0)    PDF (1020KB)(81)       Save

Large Language Models (LLMs) perform well at automatically generating unit test cases, but exhibit insufficient coverage of complex structures and critical paths, resulting in gaps in both coverage and accuracy. To address this issue, a path guidance and iterative optimization strategy was proposed by integrating Control Flow Graph (CFG) analysis with C-P-R (Context-Prompt-Response) template to enhance path guidance during test case generation. In addition, a dual-verification mechanism was introduced to improve the reliability of the generated test cases, while iterative optimization was employed to progressively fill coverage gaps. Experiments were conducted across multiple models and task scenarios, with systematic evaluation on key metrics, including statement coverage, branch coverage, and assertion accuracy. The results showed that the proposed strategy achieved an average statement coverage of 97% and a branch coverage of 94%, with strong adaptability and stability across different models. These findings indicate that combining path guidance with iterative optimization effectively enhances the coverage and reliability of test case generation, offering a feasible approach for automated testing and verification of complex software systems.

Table and Figures | Reference | Related Articles | Metrics