arXiv:2511.14002cs.SEcs.AI2025-11被引 3

用图结构精准定位代码上下文,自动修复工业级翻车测试

FlakyGuard: Automatically Fixing Flaky Tests at Industry Scale

  • 将代码建模为图,只提取最相关的上下文信息
  • 修复率47.6%,51.8%的修复被开发者采纳,优于现有方法22%以上
  • 解释清晰,100%开发者认为根因分析有帮助,适合工程团队使用

翻车测试(flaky tests)非确定性地通过或失败,浪费开发时间并拖慢发布周期。尽管大语言模型(LLMs)在自动修复翻车测试方面展现出潜力,但现有方法如FlakyDoctor在工业场景中表现不佳,原因在于上下文问题:要么上下文不足(缺少关键生产代码),要么上下文过多(向LLM输入无关信息)。我们提出FlakyGuard,通过将代码视为图结构,并采用选择性图探索策略,仅获取最相关上下文。在真实工业仓库中的翻车测试评估显示,FlakyGuard可修复47.6%的可重现翻车测试,其中51.8%的修复方案被开发者接受。此外,其修复成功率比现有最佳方法至少高出22%。开发者调查确认,100%认为FlakyGuard的根因解释有用。

原文摘要 · Abstract (English)

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.

自动化修复翻车测试大模型应用软件工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。