一句话:将代码视为图结构并选择性探索,为 LLM 精准提供修复 flaky test 所需的上下文,实现工业规模自动修复。
不稳定测试(flaky test)非确定性地通过或失败,浪费开发者时间并拖慢发布周期。尽管大语言模型(LLM)在自动修复不稳定测试上展现出潜力,现有方法(如 FlakyDoctor)在工业场景中因“上下文问题”而失效:提供的上下文过少会缺失关键生产代码,过多则用无关信息淹没 LLM。本文提出 FlakyGuard,将代码视为图结构,通过选择性图探索只找出最相关的上下文,从而在工业环境中有效驱动 LLM 完成修复并解释根因。作者在来自工业仓库的真实不稳定测试上进行评估:FlakyGuard 修复了 47.6% 的可复现不稳定测试,其中 51.8% 的修复被开发者接受,修复成功率比现有最先进方法至少高出 22%。开发者调查还显示,100% 的受访者认为 FlakyGuard 给出的根因解释有用。
Flaky tests that non-deterministically pass or fail waste developer time and slow release cycles. While large language models (LLMs) show promise for automatically repairing flaky tests, existing approaches like FlakyDoctor fail in industrial settings due to the context problem: providing either too little context (missing critical production code) or too much context (overwhelming the LLM with irrelevant information). We present FlakyGuard, which addresses this problem by treating code as a graph structure and using selective graph exploration to find only the most relevant context. Evaluation on real-world flaky tests from industrial repositories shows that FlakyGuard repairs 47.6% of reproducible flaky tests with 51.8% of the fixes accepted by developers. Besides it outperforms state-of-the-art approaches by at least 22% in repair success rate. Developer surveys confirm that 100% find FlakyGuard’s root cause explanations useful.
DOI 原文 ·
@inproceedings{paperbot9210,
title = {FlakyGuard: Automatically Fixing Flaky Tests at Industry Scale},
author = {Chengpeng Li and Farnaz Behrang and August Shi and Peng Liu},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00179}
}