Optimizing Search-Based Unit Test Generation with Large Language Models: An Empirical Study

被引:1
作者
Xiao, Danni [1 ]
Guo, Yimeng [1 ]
Li, Yanhui [1 ]
Chen, Lin [1 ]
机构
[1] Nanjing Univ, State Key Lab Novel Software Technol, Nanjing, Peoples R China
来源
PROCEEDINGS OF THE 15TH ASIA-PACIFIC SYMPOSIUM ON INTERNETWARE, INTERNETWARE 2024 | 2024年
基金
中国国家自然科学基金;
关键词
Unit Test; Search-based Testing; Large Language Model; OPTIMIZATION;
D O I
10.1145/3671016.3674813
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Search-based unit test generation methods have been considered effective and widely applied, and Large Language Models (LLMs) have also demonstrated their powerful generation ability. Therefore, some scholars have proposed using LLMs to enhance search-based unit test generation methods and have preliminarily confirmed that LLMs can help alleviate the problem of test coverage plateaus. However, it is still unclear when and how LLMs should intervene in the time-consuming test generation process. This paper explores the application of LLMs at various stages of search-based test generation (SBTG) (including the initial stage, the test generation period, and the test coverage plateaus), as well as strategies for controlling the frequency of LLM intervention. A comprehensive empirical study was conducted on 486 Python benchmark modules from 27 projects. The experimental results show that 1) LLM intervention has a positive effect at any stage, whether to improve coverage over a fixed period or to reduce the time to reach a specific coverage; 2) a reasonable intervention frequency is crucial for LLMs to have a positive effect on SBTG. This work can better help understand when and how LLMs should be applied in SBTG and provide valuable suggestions for developers in practice.
引用
收藏
页码:71 / 80
页数:10
相关论文
共 40 条
[1]   Causes and Effects of Fitness Landscapes in Unit Test Generation [J].
Albunian, Nasser ;
Fraser, Gordon ;
Sudholt, Dirk .
GECCO'20: PROCEEDINGS OF THE 2020 GENETIC AND EVOLUTIONARY COMPUTATION CONFERENCE, 2020, :1204-1212
[2]   Analysing the fitness landscape of search-based software testing problems [J].
Aleti, Aldeida ;
Moser, I. ;
Grunske, Lars .
AUTOMATED SOFTWARE ENGINEERING, 2017, 24 (03) :603-621
[3]   A Systematic Review of the Application and Empirical Investigation of Search-Based Test Case Generation [J].
Ali, Shaukat ;
Briand, Lionel C. ;
Hemmati, Hadi ;
Panesar-Walawege, Rajwinder K. .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2010, 36 (06) :742-762
[4]  
[Anonymous], 2009, Search based software engineering: A comprehensive analysis and review of trends techniques and applications
[5]  
[Anonymous], Adaptation in Natural and Artificial Systems | The MIT Press
[6]   Search based software testing of object-oriented containers [J].
Arcuri, Andrea ;
Yao, Xin .
INFORMATION SCIENCES, 2008, 178 (15) :3075-3095
[7]  
Baars A., 2011, 2011 26th IEEE/ACM International Conference on Automated Software Engineering, P53, DOI 10.1109/ASE.2011.6100119
[8]  
Back T., 1996, Evolutionary Algorithms in Theory and Practice: Evolution Strategies, Evolutionary Programming, Genetic Algorithms
[9]  
Bareiss P, 2022, Arxiv, DOI arXiv:2206.01335
[10]  
Baresi Luciano, 2010, Proceedings of the Third IEEE International Conference on Software Testing, Verification and Validation (ICST 2010), P185, DOI 10.1109/ICST.2010.54