TestART: Improving LLM-based Unit Test via Co-evolution of Automated Generation and Repair Iteration

考试(生物学) 单元测试 单位(环理论) 可靠性工程 计算机科学 数学 工程类 操作系统 生物 数学教育 生态学 软件
作者
Siqi Gu,Chunrong Fang,Quanjun Zhang,Fangyuan Tian,Jianyi Zhou,Zhenyu Chen
出处
期刊:Cornell University - arXiv
标识
DOI:10.48550/arxiv.2408.03095
摘要

Unit test is crucial for detecting bugs in individual program units but consumes time and effort. The existing automated unit test generation methods are mainly based on search-based software testing (SBST) and language models to liberate developers. Recently, large language models (LLMs) have demonstrated remarkable reasoning and generation capabilities. However, several problems limit their ability to generate high-quality test cases: (1) LLMs may generate invalid test cases under insufficient context, resulting in compilation errors; (2) Lack of test and coverage feedback information may cause runtime errors and low coverage rates. (3) The repetitive suppression problem causes LLMs to get stuck into the repetition loop of self-repair or re-generation attempts. In this paper, we propose TestART, a novel unit test generation method that leverages the strengths of LLMs while overcoming the limitations mentioned. TestART improves LLM-based unit test via co-evolution of automated generation and repair iteration. TestART leverages the template-based repair technique to fix bugs in LLM-generated test cases, using prompt injection to guide the next-step automated generation and avoid repetition suppression. Furthermore, TestART extracts coverage information from the passed test cases and utilizes it as testing feedback to enhance the sufficiency of the final test case. This synergy between generation and repair elevates the quality, effectiveness, and readability of the produced test cases significantly beyond previous methods. In comparative experiments, the pass rate of TestART-generated test cases is 78.55%, which is approximately 18% higher than both the ChatGPT-4.0 model and the same ChatGPT-3.5-based method ChatUniTest. It also achieves an impressive line coverage rate of 90.96% on the focal methods that passed the test, exceeding EvoSuite by 3.4%.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
更新
PDF的下载单位、IP信息已删除 (2025-6-4)

科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
小狒狒完成签到,获得积分10
刚刚
DDY发布了新的文献求助10
刚刚
师宁完成签到,获得积分10
刚刚
李顺杰完成签到,获得积分10
1秒前
无极微光发布了新的文献求助10
1秒前
1秒前
chdhg完成签到 ,获得积分10
1秒前
宋江他大表哥完成签到,获得积分10
1秒前
zzz完成签到,获得积分10
2秒前
香香完成签到,获得积分10
2秒前
2秒前
刘子迪发布了新的文献求助10
3秒前
现代柠檬完成签到,获得积分10
3秒前
luoluo完成签到,获得积分10
5秒前
成就绮琴完成签到 ,获得积分10
5秒前
小闫同学完成签到 ,获得积分10
5秒前
我是老大应助Sun采纳,获得10
5秒前
Benjamin完成签到,获得积分10
6秒前
镓氧锌钇铀应助江屿采纳,获得20
7秒前
7秒前
双双完成签到,获得积分10
7秒前
pluto应助科研通管家采纳,获得10
7秒前
研友_VZG7GZ应助科研通管家采纳,获得10
7秒前
领导范儿应助科研通管家采纳,获得10
7秒前
pluto应助科研通管家采纳,获得10
7秒前
Lucas应助科研通管家采纳,获得10
7秒前
BINGBING1230发布了新的文献求助10
7秒前
pluto应助科研通管家采纳,获得10
7秒前
所所应助科研通管家采纳,获得10
8秒前
赵景月完成签到,获得积分10
8秒前
pluto应助科研通管家采纳,获得10
8秒前
wlscj应助科研通管家采纳,获得20
8秒前
Zx_1993应助科研通管家采纳,获得30
8秒前
彭于彦祖应助科研通管家采纳,获得150
8秒前
鸣蜩阿六完成签到,获得积分10
8秒前
大个应助科研通管家采纳,获得10
8秒前
无花果应助科研通管家采纳,获得10
8秒前
Jennifer应助科研通管家采纳,获得10
8秒前
隐形曼青应助科研通管家采纳,获得10
8秒前
科研通AI6应助科研通管家采纳,获得10
8秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
Bandwidth Choice for Bias Estimators in Dynamic Nonlinear Panel Models 2000
HIGH DYNAMIC RANGE CMOS IMAGE SENSORS FOR LOW LIGHT APPLICATIONS 1500
茶艺师试题库(初级、中级、高级、技师、高级技师) 1000
Constitutional and Administrative Law 1000
The Social Work Ethics Casebook: Cases and Commentary (revised 2nd ed.). Frederic G. Reamer 800
Vertebrate Palaeontology, 5th Edition 530
热门求助领域 (近24小时)
化学 材料科学 医学 生物 工程类 有机化学 生物化学 物理 纳米技术 计算机科学 内科学 化学工程 复合材料 物理化学 基因 遗传学 催化作用 冶金 量子力学 光电子学
热门帖子
关注 科研通微信公众号,转发送积分 5358458
求助须知:如何正确求助?哪些是违规求助? 4489594
关于积分的说明 13974558
捐赠科研通 4391418
什么是DOI,文献DOI怎么找? 2412444
邀请新用户注册赠送积分活动 1405051
关于科研通互助平台的介绍 1379635