arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.10304cs.SEcs.LG
收藏

基于LLM的测试用例生成:用于检测似是而非程序中的Bug

LLM-Powered Test Case Generation for Detecting Bugs in Plausible Programs

Peking University(北京大学);Nanyang Technological University(南洋理工大学);King’s College London(伦敦国王学院);University College London(伦敦大学学院);National Key Laboratory of Data Space Technology and System(数据空间技术与系统国家重点实验室)

Kaibo Liu, Zhenpeng Chen, Yiyang Liu, Jie M. Zhang, Mark Harman, Yudong Han, Yun Ma, Yihong Dong, Ge Li, Gang Huang

AI总结:

针对似是而非程序中棘手Bug的检测难题,提出基于LLM的三阶段方法TrickCatcher,通过生成程序变体和测试输入并比较输出不一致性来发现Bug,在召回率、精确率和F1分数上分别达到SOTA基线的1.80倍、2.65倍和1.66倍。

摘要:

检测似是而非程序中的棘手Bug(即那些通过了现有测试套件但仍然包含Bug的程序)仍然是软件测试中的一个重大挑战。为了解决这个问题,我们提出了TrickCatcher,一种基于LLM的方法,用于生成测试用例以发现似是而非程序中的Bug。TrickCatcher分三个阶段运行:首先,它使用LLM基于被测程序(PUT)及其规范生成程序变体。其次,它利用LLM根据规范构建一个输入生成器,用于产生测试输入。最后,这些输入在PUT及其程序变体上执行,以检测它们输出中的不一致性。我们在两个数据集TrickyBugs和EvalPlus上评估了TrickCatcher,这些数据集包含366个人类编写的和151个AI生成的带有棘手Bug的似是而非程序。TrickCatcher的召回率、精确率和F1分数分别是最先进基线的1.80倍、2.65倍和1.66倍。所使用的代码和数据可在https://github.com/RinCloud/TrickCatcher获取。

英文摘要:

Detecting tricky bugs in plausible programs, those that pass existing test suites yet still contain bugs, remains a significant challenge in software testing. To address this problem, we propose TrickCatcher, an LLM-powered approach to generating test cases for uncovering bugs in plausible programs. TrickCatcher operates in three stages: First, it uses an LLM to generate program variants based on the program under test (PUT) and its specification. Second, it employs an LLM to construct an input generator from the specification for producing test inputs. Finally, these inputs are executed on both the PUT and its program variants to detect inconsistencies in their outputs. We evaluate TrickCatcher on two datasets, TrickyBugs and EvalPlus, which include 366 human-written and 151 AI-generated plausible programs with tricky bugs. TrickCatcher achieves recall, precision, and F1 scores that are 1.80x, 2.65x, and 1.66x those of the state-of-the-art baselines, respectively. Code and data used are available at https://github.com/RinCloud/TrickCatcher.

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

↑