High-Coverage LLM-based Unit Test Code Generation through Control Flow Graph Guidance

计算机科学 图形 算法 控制流程图 编码(集合论) 控制系统 关系(数据库) 控制(管理) 流量(数学) 单位(环理论) 控制单元
作者
Xinran Luo,Cheng Liu,Mengchen Zhao,Zhibin Wu,Tao Lu,Junying Chen
出处
期刊: [Institute of Electrical and Electronics Engineers]
卷期号:: 1-8 被引量:1
标识
DOI:10.1109/ijcnn69854.2026.11729616
摘要

Unit testing is a critical yet labor intensive phase in software development. Although large language models (LLMs) have shown promise in unit test code generation, existing LLM-based methods often suffer from limited code understanding, high error rate, and low test coverage. We propose an approach that leverages control flow graphs (CFGs) to improve test quality and coverage. Our method comprises three phases. In the data pre-processing phase, we extract focal methods and dependencies from Java projects and construct CFGs from the abstract syntax tree, which allows LLMs to better focus on the core logic. In the code generation phase, we use LLM to decompose each focal method into CFG-based code slices and generate a coherent unit test code for each slice. In the post-processing optimization phase, we apply a two-stage repair strategy for failing tests to ensure greater test executability, combining template-based repair with LLM-based repair. To further boost coverage, we analyze uncovered control paths via the CFG and guide the LLM to optimize the unit test code test cases accordingly. Experimental results show that our approach significantly outperforms baselines in terms of test execution pass rate and code coverage, with ablation studies highlighting strong inter-module synergy. All experimental data and source code are available at https://github.com/EllaDrCarrot/LUGC.

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
xjz071120发布了新的文献求助10
刚刚
Zhou完成签到,获得积分10
刚刚
NexusExplorer的应助被neullt采纳,获得10
1秒前
1秒前
ZIwang发布了新的文献求助10
1秒前
科目三的应助被he采纳,获得10
2秒前
2秒前
Bruce完成签到,获得积分10
3秒前
沐心完成签到,获得积分10
3秒前
4秒前
4秒前
123完成签到,获得积分10
4秒前
gbbcq完成签到 ,获得积分10
4秒前
稳重的哑铃完成签到,获得积分10
4秒前
4秒前
5秒前
Yvonne完成签到,获得积分10
5秒前
科目三的应助被冯123采纳,获得10
5秒前
5秒前
在水一方的应助被牦牛梅花鱼采纳,获得10
5秒前
5秒前
常璨璨完成签到,获得积分10
6秒前
Dcientist完成签到,获得积分10
6秒前
6秒前
6秒前
6秒前
王223发布了新的文献求助10
6秒前
7秒前
xpp完成签到,获得积分10
7秒前
852的应助被Voloid采纳,获得20
7秒前
from发布了新的文献求助10
7秒前
zindly完成签到,获得积分10
8秒前
ZZt完成签到,获得积分10
8秒前
一沙发布了新的文献求助10
8秒前
Ambition发布了新的文献求助10
8秒前
古v完成签到 ,获得积分10
9秒前
9秒前
馒头完成签到,获得积分10
10秒前
10秒前
幽默的小萱完成签到,获得积分10
11秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
Theories of Human Development 600
Orthognathic Surgery - 2 Volume Set 500
Sex, Aging, and Death in a Medieval Medical Compendium: Trinity College Cambridge MS R.14.52, Its Texts, Language, and Scribe 450
Determination of Coagulation Factor Activities Using the One-Stage Clotting Assay 400
改訂11版 化学・バイオ特許の出願戦略 全文 400
《化学系特許明細書・意見書の書き方》全文 400
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 计算机科学 工程类 有机化学 化学工程 生物化学 物理 复合材料 内科学 催化作用 光电子学 人工智能 细胞生物学 无机化学 物理化学 数学
热门帖子
关注 科研通微信公众号,转发送积分 8217461
求助须知:如何正确求助?哪些是违规求助? 9598500
关于积分的说明 21981437
捐赠科研通 7825787
什么是DOI,文献DOI怎么找? 3445359
关于科研通互助平台的介绍 2566769
邀请新用户注册赠送积分活动 2493919