paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Perfect is the enemy of test oracle

完美是测试 oracle 的敌人
FSE Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2022匹配度 4/10 · 该论文用神经网络嵌入(非 LLM/Agent)来做测试 oracle 判定,属于「AI→软件工程」大类,与用户的 AI→PL(用 LLM/Agent 改进静态分析与形式化验证)只沾边;既不涉及静态分析、浮点程序分析,也不涉及贝叶斯程序分析或 Agentic 程序,且方法建立在 2022 年前后的神经模型而非当前强 LLM 之上。引用 23 inbox
Ali Reza Ibrahimzada, Yigit Varli, Dilara Tekinoglu, Reyhaneh Jabbarvand
crossref: 2026-09-12

AI 速览

一句话:提出基于学习的测试 oracle,无需断言即可判定单元测试通过或失败。

测试 oracle 自动化是软件测试中的难点:传统 oracle 依赖能区分正确与缺陷行为的地面真值,而对精确正确或缺陷行为的假设使其不可判定且难以实现。本文提出一种学习型方法,在缺少断言或其他 oracle 时,通过将单元测试与被测方法实现联合嵌入统一向量空间,使测试与通过的 MUT 表示相似、与失败的 MUT 表示相异,并训练分类器作为 oracle 预测 pass/fail 标签。在 5K+ 个来自多样开源 Java 项目的单元测试上,该方法取得 93% 准确率、86% 精确率、94% 召回率和 90% F1;跨项目泛化性能几乎不下降,平均仅需 6.5 毫秒检测缺陷。通过解释神经模型,作者还验证了 oracle 依赖相关特征进行预测。

问题
测试 oracle 自动化困难,传统方法假设必须知道精确的正确或缺陷行为,这使 oracle 问题不可判定且难以实现。本文关注在缺少断言或其他 oracle 时,如何判定单元测试对被测方法的通过或失败。
方法
将单元测试与被测方法实现联合嵌入统一向量空间,使测试与通过的 MUT 表示相似、与失败的 MUT 表示相异,并在该表示上训练分类器作为 oracle 生成 pass/fail 标签。
评估
在 5K+ 个多样开源 Java 项目的单元测试上评估,报告 93% 准确率、86% 精确率、94% 召回率和 90% F1;跨项目泛化性能几乎不降,平均 6.5 毫秒检测缺陷,并通过解释神经模型验证其有效性。
原文摘要(Abstract)

Automation of test oracles is one of the most challenging facets of software testing, but remains comparatively less addressed compared to automated test input generation. Test oracles rely on a ground-truth that can distinguish between the correct and buggy behavior to determine whether a test fails (detects a bug) or passes. What makes the oracle problem challenging and undecidable is the assumption that the ground-truth should know the exact expected, correct, or buggy behavior. However, we argue that one can still build an accurate oracle without knowing the exact correct or buggy behavior, but how these two might differ. This paper presents , a learning-based approach that in the absence of test assertions or other types of oracle, can determine whether a unit test passes or fails on a given method under test (MUT). To build the ground-truth, jointly embeds unit tests and the implementation of MUTs into a unified vector space, in such a way that the neural representation of tests are similar to that of MUTs they pass on them, but dissimilar to MUTs they fail on them. The classifier built on top of this vector representation serves as the oracle to generate “fail” labels, when test inputs detect a bug in MUT or “pass” labels, otherwise. Our extensive experiments on applying to more than 5K unit tests from a diverse set of open-source Java projects show that the produced oracle is (1) effective in predicting the fail or pass labels, achieving an overall accuracy, precision, recall, and F1 measure of 93%, 86%, 94%, and 90%, (2) generalizable, predicting the labels for the unit test of projects that were not in training or validation set with negligible performance drop, and (3) efficient, detecting the existence of bugs in only 6.5 milliseconds on average. Moreover, by interpreting the neural model and looking at it beyond a closed-box solution, we confirm that the oracle is valid, i.e., it predicts the labels through learning relevant features.

链接与引用

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

BibTeX
@inproceedings{paperbot6968,
  title = {Perfect is the enemy of test oracle},
  author = {Ali Reza Ibrahimzada and Yigit Varli and Dilara Tekinoglu and Reyhaneh Jabbarvand},
  booktitle = {FSE},
  year = {2022},
  doi = {10.1145/3540250.3549086}
}