arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.09879cs.SE
收藏

基于历史缺陷报告驱动的LLM重构引擎测试

Testing Refactoring Engine via Historical Bug Report driven LLM

Haibo Wang, Zhuolin Xu, Shin Hwei Tan

AI总结:

提出RETESTER框架,利用历史缺陷报告和思维链提示生成重构变体,通过差分测试在Eclipse和IntelliJ IDEA中发现18个新缺陷。

摘要:

重构是在不改变代码外部行为的前提下,改善其内部结构的过程。重构引擎是现代集成开发环境(IDE)的重要组成部分,可以自动化或半自动化地执行这一过程,以提高代码可读性、降低复杂性并改善软件产品的可维护性。与编译器之类的传统软件系统类似,重构引擎也可能包含导致意外行为的缺陷。在本文中,我们提出了一种名为RETESTER的新方法,这是一个基于LLM的自动化重构引擎测试框架。具体而言,通过利用从历史缺陷报告中提取的输入程序结构模板和容易出错的输入程序特征,我们设计了思维链(CoT)提示来执行保留重构的变换。然后,使用差分测试在最新版本的重构引擎上测试生成的变体。我们在两个最流行的现代重构引擎(即ECLIPSE和INTELLIJ IDEA)上评估了RETESTER。它成功地在这些重构引擎的最新版本中发现了18个新缺陷。在我们提交论文时,其中7个已得到开发人员确认,3个已修复。

英文摘要:

Refactoring is the process of restructuring existing code without changing its external behavior while improving its internal structure. Refactoring engines are integral components of modern Integrated Development Environments (IDEs) and can automate or semi-automate this process to enhance code readability, reduce complexity, and improve the maintainability of software products. Similar to traditional software systems such as compilers, refactoring engines may also contain bugs that can lead to unexpected behaviors. In this paper, we propose a novel approach called RETESTER, a LLM-based framework for automated refactoring engine testing. Specifically, by using input program structure templates extracted from historical bug reports and input program characteristics that are error-prone, we design chain-of-thought (CoT) prompts to perform refactoring-preserving transformations. The generated variants are then tested on the latest version of refactoring engines using differential testing. We evaluate RETESTER on two most popular modern refactoring engines (i.e., ECLIPSE, and INTELLIJ IDEA). It successfully revealed 18 new bugs in the latest version of those refactoring engines. By the time we submit our paper, seven of them were confirmed by their developers, and three were fixed.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑