亲爱的研友该休息了!由于当前在线用户较少,发布求助请尽量完整的填写文献信息,科研通机器人24小时在线,伴您度过漫漫科研夜!身体可是革命的本钱,早点休息,好梦!

Exploring Automated Assertion Generation via Large Language Models

断言 计算机科学 程序设计语言 软件工程
作者
Quanjun Zhang,Weifeng Sun,Chunrong Fang,Bowen Yu,H. Li,Meng Yan,Jianyi Zhou,Zhenyu Chen
出处
期刊:ACM Transactions on Software Engineering and Methodology [Association for Computing Machinery]
被引量:2
标识
DOI:10.1145/3699598
摘要

Unit testing aims to validate the correctness of software system units and has become an essential practice in software development and maintenance. However, it is incredibly time-consuming and labor-intensive for testing experts to write unit test cases manually, including test inputs ( i.e., prefixes) and test oracles ( i.e., assertions). Very recently, some techniques have been proposed to apply Large Language Models (LLMs) to generate unit assertions and have proven the potential in reducing manual testing efforts. However, there has been no systematic comparison of the effectiveness of these LLMs, and their pros and cons remain unexplored. To bridge this gap, we perform the first extensive study on applying various LLMs to automated assertion generation. The experimental results on two independent datasets show that studied LLMs outperform six state-of-the-art techniques with a prediction accuracy of 51.82% \(\sim\) 58.71% and 38.72% \(\sim\) 48.19%. The improvements achieve 29.60% and 12.47% on average. Besides, as a representative LLM, CodeT5 consistently outperforms all studied LLMs and all baselines on both datasets, with an average improvement of 13.85% and 26.64%, respectively. We also explore the performance of generated assertions in detecting real-world bugs, and find LLMs are able to detect 32 bugs from Defects4J on average, with an improvement of 52.38% against the most recent approach EditAS . Inspired by the findings, we construct a simplistic retrieval-and-repair-enhanced LLM-based approach by transforming the assertion generation problem into a program repair task for retrieved similar assertions. Surprisingly, such a simplistic approach can further improve the prediction accuracy of LLMs by 9.40% on average, leading to new records on both datasets. Besides, we provide additional discussions from different aspects ( e.g., the impact of assertion types and test lengths) to illustrate the capacity and limitations of LLM-based approaches. Finally, we further pinpoint various practical guidelines ( e.g., the improvement of multiple candidate assertions) for advanced LLM-based assertion generation in the near future. Overall, our work underscores the promising future of adopting off-the-shelf LLMs to generate accurate and meaningful assertions in real-world test cases and reduce the manual efforts of unit testing experts in practical scenarios.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
羊羊羊完成签到 ,获得积分10
2秒前
陶醉的蜜蜂完成签到 ,获得积分10
4秒前
JamesPei应助科研通管家采纳,获得10
10秒前
科研通AI2S应助科研通管家采纳,获得10
10秒前
星辰大海应助科研通管家采纳,获得10
10秒前
汉堡包应助cc采纳,获得10
14秒前
17秒前
20秒前
是是是发布了新的文献求助10
23秒前
27秒前
Owen应助是是是采纳,获得10
30秒前
英俊的铭应助冷艳的立果采纳,获得10
30秒前
35秒前
cc发布了新的文献求助10
41秒前
43秒前
joanna完成签到,获得积分10
43秒前
les完成签到,获得积分10
44秒前
鲜艳的马里奥完成签到,获得积分10
51秒前
51秒前
les发布了新的文献求助10
57秒前
1分钟前
研友_ZbP41L完成签到 ,获得积分10
1分钟前
1分钟前
1分钟前
1分钟前
小二郎应助啊强采纳,获得10
1分钟前
jessie完成签到 ,获得积分10
1分钟前
1分钟前
HJJHJH发布了新的文献求助20
1分钟前
1分钟前
NexusExplorer应助凶狠的秀发采纳,获得10
1分钟前
在水一方完成签到 ,获得积分10
1分钟前
2分钟前
啊强发布了新的文献求助10
2分钟前
2分钟前
禅伯发布了新的文献求助10
2分钟前
2分钟前
2分钟前
是是是发布了新的文献求助10
2分钟前
3分钟前
高分求助中
Continuum Thermodynamics and Material Modelling 3000
Production Logging: Theoretical and Interpretive Elements 2700
Mechanistic Modeling of Gas-Liquid Two-Phase Flow in Pipes 2500
Structural Load Modelling and Combination for Performance and Safety Evaluation 1000
Conference Record, IAS Annual Meeting 1977 720
電気学会論文誌D(産業応用部門誌), 141 巻, 11 号 510
Typology of Conditional Constructions 500
热门求助领域 (近24小时)
化学 材料科学 生物 医学 工程类 有机化学 生物化学 物理 纳米技术 计算机科学 内科学 化学工程 复合材料 基因 遗传学 物理化学 催化作用 量子力学 光电子学 冶金
热门帖子
关注 科研通微信公众号,转发送积分 3566604
求助须知:如何正确求助?哪些是违规求助? 3139331
关于积分的说明 9431521
捐赠科研通 2840168
什么是DOI,文献DOI怎么找? 1560963
邀请新用户注册赠送积分活动 730120
科研通“疑难数据库(出版商)”最低求助积分说明 717828