一句话:提出神经符号技术 FlakyDoctor,结合 LLM 的泛化性与程序分析的可靠性,自动修复多种类型的测试不稳定。
测试不稳定(flaky test)指与代码变更无关的非确定性构建行为,严重阻碍可靠软件的交付。现有极少数自动修复技术仅针对顺序依赖(OD)或实现依赖(ID)中的单一类型,且全为符号方法,依赖程序分析检测已知的不稳定模式与根因,泛化能力差。为此,作者提出 FlakyDoctor,一种神经符号技术,将 LLM 的泛化能力与程序分析的可靠性相结合,以修复不同类型的不稳定测试。在来自 243 个真实项目的 873 个已确认不稳定测试(332 个 OD、541 个 ID)上评估,OD 与 ID 的修复成功率分别为 57% 和 59%;相比 DexFix 多修复 8% 的 ID 测试,相比 ODRepair 多修复 12% 的 OD 测试,相比 iFixFlakies 多修复 17% 的 OD 测试。非 LLM 组件贡献了总体性能的 12–31%。该技术还修复了 79 个此前未被修复的真实项目不稳定测试,作者为所有案例提交了带补丁的 pull request,其中 19 个已被接受并合并。
Test flakiness, a non-deterministic behavior of builds irrelevant to code changes, is a major and continuing impediment to deliver- ing 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., they leverage program analy- sis 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.