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

一种修复真实项目中测试不稳定性的通用方法

A Generic Approach to Fix Test Flakiness in Real-World Projects

Yang Chen, Reyhaneh Jabbarvand

AI总结:

针对现有测试不稳定性修复技术泛化性差的问题,提出结合LLM与程序分析的神经符号技术FlakyDoctor,在真实项目多类型不稳定测试修复上效果优于现有方法,且部分补丁已被合并。

摘要:

测试不稳定性是指构建过程中与代码变更无关的非确定性行为,是交付可靠软件过程中持续存在的主要障碍。现有的极少数自动化修复测试不稳定性的技术,都是专门为修复顺序依赖型(OD)或实现依赖型(ID)不稳定性而设计的。这些技术也都属于符号方法,即利用程序分析来检测和修复已知的测试不稳定模式及根本原因,缺乏泛化能力。为弥补这一缺口,我们提出FlakyDoctor(一种神经符号技术),它结合了大语言模型(LLM)的泛化能力与程序分析的可靠性,可修复不同类型的测试不稳定性。我们使用来自243个真实项目的873个已确认不稳定测试(332个OD型、541个ID型)开展了广泛评估,结果证明了FlakyDoctor的修复能力,其在OD型测试上成功率达57%,在ID型测试上达59%。与三种备选的不稳定性修复方法相比,FlakyDoctor修复的ID型测试数量比DexFix多8%,修复的OD型不稳定测试数量比ODRepair多12%,比iFixFlakies多17%。无论底层使用何种LLM,FlakyDoctor的非LLM组件对整体性能的贡献占比为12%-31%,也就是说,尽管FlakyDoctor的部分能力来自LLM,但仅靠LLM不足以修复真实项目中的不稳定测试。这项技术相较于测试不稳定性缓解乃至一般程序修复领域相关研究的优势在于,它修复了真实项目中79个此前无法修复的不稳定测试。我们为所有生成对应补丁的案例提交了拉取请求;截至投稿时,其中19个已被接受并合并。

英文摘要:

Test flakiness, a non-deterministic behavior of builds irrelevant to code changes, is a major and continuing impediment to delivering reliable software. The very few techniques for the automated repair of test flakiness are specifically crafted to repair either Order-Dependent (OD) or Implementation-Dependent (ID) flakiness. They are also all symbolic approaches, i.e., leverage program analysis to detect and repair known test flakiness patterns and root causes, failing to generalize. To bridge the gap, we propose FlakyDoctor, a neuro-symbolic technique that combines the power of LLMs-generalizability-and program analysis-soundness-to fix different types of test flakiness. Our extensive evaluation using 873 confirmed flaky tests (332 OD and 541 ID) from 243 real-world projects demonstrates the ability of FlakyDoctor in repairing flakiness, achieving 57% (OD) and 59% (ID) success rate. Comparing to three alternative flakiness repair approaches, FlakyDoctor can repair 8% more ID tests than DexFix, 12% more OD flaky tests than ODRepair, and 17% more OD flaky tests than iFixFlakies. Regardless of underlying LLM, the non-LLM components of FlakyDoctor contribute to 12-31% of the overall performance, i.e., while part of the FlakyDoctor power is from using LLMs, they are not good enough to repair flaky tests in real-world projects alone. What makes the proposed technique superior to related research on test flakiness mitigation specifically and program repair, in general, is repairing 79 previously unfixed flaky tests in real-world projects. We opened pull requests for all cases with corresponding patches; 19 of them were accepted and merged at the time of submission.

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

↑