On the Evaluation of Large Language Models in Unit Test Generation

被引:3
作者
Yang, Lin [1 ]
Yang, Chen [1 ]
Gao, Shutao [2 ]
Wang, Weijing [1 ]
Wang, Bo [3 ]
Zhu, Qihao [4 ]
Chu, Xiao [5 ]
Zhou, Jianyi [5 ]
Liang, Guangtai [5 ]
Wang, Qianxiang [5 ]
Chen, Junjie [1 ]
机构
[1] Tianjin Univ, Coll Intelligence & Comp, Tianjin, Peoples R China
[2] Tianjin Univ, Sch Future Technol, Tianjin, Peoples R China
[3] Beijing Jiaotong Univ, Sch Comp & Informat Technol, Beijing, Peoples R China
[4] Peking Univ, Key Lab HCST, MoE DCST, Beijing, Peoples R China
[5] Huawei Cloud Comp Co Ltd, Hangzhou, Peoples R China
来源
PROCEEDINGS OF 2024 39TH ACM/IEEE INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING, ASE 2024 | 2024年
基金
中国国家自然科学基金;
关键词
Large Language Model; Unit Test Generation; Empirical Study;
D O I
10.1145/3691620.3695529
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Unit testing is an essential activity in software development for verifying the correctness of software components. However, manually writing unit tests is challenging and time-consuming. The emergence of Large Language Models (LLMs) offers a new direction for automating unit test generation. Existing research primarily focuses on closed-source LLMs (e.g., ChatGPT and CodeX) with fixed prompting strategies, leaving the capabilities of advanced open-source LLMs with various prompting settings unexplored. Particularly, open-source LLMs offer advantages in data privacy protection and have demonstrated superior performance in some tasks. Moreover, effective prompting is crucial for maximizing LLMs' capabilities. In this paper, we conduct the first empirical study to fill this gap, based on 17 Java projects, five widely-used open-source LLMs with different structures and parameter sizes, and comprehensive evaluation metrics. Our findings highlight the significant influence of various prompt factors, show the performance of open-source LLMs compared to the commercial GPT-4 and the traditional Evosuite, and identify limitations in LLM-based unit test generation. We then derive a series of implications from our study to guide future research and practical use of LLM-based unit test generation.
引用
收藏
页码:1607 / 1619
页数:13
相关论文
共 93 条
[1]  
2023, Arxiv, DOI [arXiv:2303.08774, DOI 10.48550/ARXIV.2303.08774, 10.48550/arXiv.2303.08774]
[2]  
Agrawal LA, 2023, ADV NEUR IN
[3]  
Alagarsamy Saranya, 2023, CoRR abs/2302.10352
[4]  
Amatriain Xavier, 2024, abs/2401.14423
[5]  
[Anonymous], 2024, HOM
[6]  
[Anonymous], 2024, Big code models leaderboard
[7]  
[Anonymous], 2023, Transformers
[8]  
Bhatia Shreya, 2023, CoRR abs/2312.10622
[9]  
Chen Xiangping, SCIENCE CHINA Information Sciences
[10]  
Cohen J., 1988, Statistical Power Analysis for the Behavioral Sciences., V2nd, DOI [DOI 10.1007/978-1-4684-5439-0_2, DOI 10.4324/9780203771587, 10.4324/9780203771587]