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%.

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

科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
蔡从安发布了新的文献求助10
19秒前
丫丫完成签到 ,获得积分10
19秒前
点点完成签到 ,获得积分10
24秒前
量子星尘发布了新的文献求助10
26秒前
和平使命应助科研通管家采纳,获得10
29秒前
小明完成签到 ,获得积分10
29秒前
whitepiece完成签到,获得积分10
30秒前
105完成签到 ,获得积分10
31秒前
俊逸吐司完成签到 ,获得积分10
33秒前
John完成签到 ,获得积分10
33秒前
38秒前
Song完成签到 ,获得积分10
41秒前
蔡从安发布了新的文献求助10
43秒前
默默莫莫完成签到 ,获得积分10
44秒前
温如军完成签到 ,获得积分10
46秒前
量子星尘发布了新的文献求助10
47秒前
蚊蚊爱读书应助蔡从安采纳,获得10
49秒前
mmd完成签到 ,获得积分10
51秒前
好运连连完成签到 ,获得积分10
56秒前
zhangkx23完成签到,获得积分10
57秒前
Lyw完成签到 ,获得积分10
1分钟前
sure完成签到 ,获得积分10
1分钟前
殷勤的紫槐完成签到,获得积分0
1分钟前
李天浩完成签到 ,获得积分10
1分钟前
myq完成签到 ,获得积分10
1分钟前
一见憘完成签到 ,获得积分10
1分钟前
1分钟前
量子星尘发布了新的文献求助10
1分钟前
温暖完成签到 ,获得积分10
1分钟前
1分钟前
藏锋完成签到 ,获得积分10
1分钟前
酷炫觅双完成签到 ,获得积分10
1分钟前
暖羊羊Y完成签到 ,获得积分10
1分钟前
1分钟前
傲娇书易应助davedavedave采纳,获得20
1分钟前
哥哥发布了新的文献求助10
1分钟前
潇湘完成签到 ,获得积分10
1分钟前
所所应助哥哥采纳,获得10
1分钟前
好好好完成签到 ,获得积分10
1分钟前
puritan完成签到 ,获得积分10
1分钟前
高分求助中
Encyclopedia of Immunobiology Second Edition 5000
Clinical Microbiology Procedures Handbook, Multi-Volume, 5th Edition 临床微生物学程序手册,多卷,第5版 2000
List of 1,091 Public Pension Profiles by Region 1621
Les Mantodea de Guyane: Insecta, Polyneoptera [The Mantids of French Guiana] | NHBS Field Guides & Natural History 1500
The Victim–Offender Overlap During the Global Pandemic: A Comparative Study Across Western and Non-Western Countries 1000
Lloyd's Register of Shipping's Approach to the Control of Incidents of Brittle Fracture in Ship Structures 1000
Brittle fracture in welded ships 1000
热门求助领域 (近24小时)
化学 材料科学 生物 医学 工程类 计算机科学 有机化学 物理 生物化学 纳米技术 复合材料 内科学 化学工程 人工智能 催化作用 遗传学 数学 基因 量子力学 物理化学
热门帖子
关注 科研通微信公众号,转发送积分 5584832
求助须知:如何正确求助?哪些是违规求助? 4668720
关于积分的说明 14771614
捐赠科研通 4615564
什么是DOI,文献DOI怎么找? 2530253
邀请新用户注册赠送积分活动 1499111
关于科研通互助平台的介绍 1467575