paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Detecting Flaky Tests by Controlling Nondeterministic API Behavior

通过控制非确定性 API 行为检测不稳定测试(flaky tests)
OOPSLA 10(OOPSLA1)2026匹配度 2/10 · 论文属于软件测试中的 flaky test 检测,基于动态扰动 Java 标准库 API 行为,不涉及静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析,与用户研究画像的核心方向关联很弱。引用 0 inbox
Hengchen Yuan, Jiefang Lin, August Shi
crossref: 2026-09-10

AI 速览

一句话:ChaosAPI 通过系统扰动 Java 标准库中非确定性 API 的行为,主动检测多种类型的不稳定测试。

回归测试中不稳定测试(flaky tests)会使测试结果不可靠,因此需要尽早主动检测。已有方法要么只针对特定类型的不稳定测试,要么依赖 AI 预测而分析不精确。本文提出 ChaosAPI,其核心思想是直接针对导致测试不稳定的非确定性来源:Java 标准库中与系统时间、并发、环境因素等相关的 API。在测试执行期间,ChaosAPI 以符合 API 规范的方式系统性地扰动这些 API 调用的输入与返回值,并通过观察原本通过的测试是否失败来检测不稳定测试。作者在已知不稳定测试数据集及多个流行开源项目的测试套件上进行了评估,结果表明 ChaosAPI 不仅能比简单重复运行在更广的项目范围内检测到更多不稳定测试,而且检测效率更高,是实用且有效的不稳定测试检测工具。

问题
现有不稳定测试检测方法通常只覆盖特定类型,或依赖不精确的 AI 预测,难以在多种项目中高效、准确地主动发现不稳定测试。
方法
识别 Java 标准库中系统时间、并发与环境等非确定性 API,在测试执行时以符合 API 规范的方式系统扰动其输入与返回值,并观察原本通过的测试是否因此失败。
评估
在已有已知不稳定测试数据集以及多个流行开源项目的测试套件上进行评估,并与简单重复运行对比,展示检测数量与检测效率上的优势。
原文摘要(Abstract)

Regression testing is an essential part of software development to ensure high-quality software; but the presence of flaky tests makes the testing outcomes unreliable. It is essential to proactively detect flaky tests, so developers are aware of them early on and can react appropriately in case they fail. While there has been prior work in detecting flaky tests, they either are developed to focus on specific flaky test types or can be imprecise in their analyses, such as by relying on AI models for prediction. We present ChaosAPI, a framework to support detecting a variety of different types of flaky tests. Our insight is that the most effective approach to detecting flaky tests is to target the nondeterministic components that lead tests to have the flaky behavior in the first place. In particular, we target specific APIs within the Java Standard Library that all Java code relies on and that are known to exhibit nondeterministic behavior, such as those related to system time, concurrency, and environmental factors. During test execution, ChaosAPI modifies the behavior of these API calls, perturbing inputs and return values of these APIs in a systematic manner while still remaining compliant with the API specification. We can detect flaky tests by observing whether tests that previously passed would now fail when run through ChaosAPI. Our evaluation on a prior dataset of known flaky tests, as well as running on test suites of other popular open-source projects, demonstrates that ChaosAPI not only detects more flaky tests than simple rerunning across a wide range of projects but also detects them more efficiently, making ChaosAPI a practical addition to the toolbox of flaky test detection techniques.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3827,
  title = {Detecting Flaky Tests by Controlling Nondeterministic API Behavior},
  author = {Hengchen Yuan and Jiefang Lin and August Shi},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA1},
  year = {2026},
  doi = {10.1145/3798265}
}