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

LLMorpheus:使用大型语言模型进行变异测试

LLMorpheus: Mutation Testing using Large Language Models

Frank Tip, Jonathan Bell, Max Schaefer

AI总结:

本文提出基于大型语言模型的变异测试技术 LLMorpheus,通过在源代码指定位置引入占位符并提示 LLM 生成替换内容,克服了传统固定变异算子难以模拟真实漏洞的局限,并能生成 StrykerJS 无法生成的变异体,证明了其实用性。

摘要:

在变异测试中,通过向程序中引入故障并确定程序的测试是否能检测到它们来评估测试套件的质量。现有的变异测试方法大多采用固定的变异算子集合,例如将“+”替换为“-”,或移除函数体。然而,某些类型的真实世界漏洞难以通过此类方法模拟,限制了其有效性。本文提出了一种变异测试技术,在程序源代码的指定位置引入占位符,并提示大型语言模型(LLM)询问可以用什么来替换它们。该技术在面向 JavaScript 的变异测试工具 LLMorpheus 中实现,并在 13 个目标包上进行了评估,考察了多种提示策略变体并使用了多个 LLM。我们发现 LLMorpheus 能够生成类似于现有漏洞的变异体,而这些变异体无法由最先进的变异测试工具 StrykerJS 生成。此外,我们报告了 LLMorpheus 的运行时间、成本和生成的变异体数量,证明了其实用性。

英文摘要:

In mutation testing, the quality of a test suite is evaluated by introducing faults into a program and determining whether the program's tests detect them. Most existing approaches for mutation testing involve the application of a fixed set of mutation operators, e.g., replacing a "+" with a "-", or removing a function's body. However, certain types of real-world bugs cannot easily be simulated by such approaches, limiting their effectiveness. This paper presents a technique for mutation testing where placeholders are introduced at designated locations in a program's source code and where a Large Language Model (LLM) is prompted to ask what they could be replaced with. The technique is implemented in LLMorpheus, a mutation testing tool for JavaScript, and evaluated on 13 subject packages, considering several variations on the prompting strategy, and using several LLMs. We find LLMorpheus to be capable of producing mutants that resemble existing bugs that cannot be produced by StrykerJS, a state-of-the-art mutation testing tool. Moreover, we report on the running time, cost, and number of mutants produced by LLMorpheus, demonstrating its practicality.

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

↑