paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Rotten Green Tests

腐烂的绿色测试
ICSE 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE)2019匹配度 2/10 · 该论文属于软件测试与程序分析,结合静态/动态调用点分析检测未执行断言的“腐烂绿色测试”,但与用户核心方向(LLM/Agent 与静态分析交叉、ML 系统分析、浮点程序分析、贝叶斯程序分析)没有直接关联。引用 23 inbox
Julien Delplanque, Stephane Ducasse, Guillermo Polito, Andrew P. Black, Anne Etien
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出腐烂绿色测试问题,结合静态与动态调用点分析检测通过但断言未执行的测试,并实现 DrTest 工具。

单元测试中,绿色(通过)通常被视为被测代码正确的可靠标志;但有些绿色测试包含从未执行的断言,作者称之为“腐烂绿色测试”。这类测试比失败测试更危险:它们声称代码有效,实际并未检验有效性。论文提出结合简单静态与动态调用点分析来识别腐烂绿色测试,并考虑测试辅助方法、继承辅助方法与 trait 组合,实现了工具 DrTest。DrTest 无假阴性,但因条件使用或多测试上下文仍会产生少量假阳性。作者对 Pharo 生态成熟项目中的 19,905 个真实测试用例进行实证评估,检测出 294 个腐烂测试;其中一些已在 Pharo 中“沉睡”至少 5 年。

问题
绿色单元测试常被视为代码正确的证据,但其中断言可能从未执行,从而提供虚假信心;论文将此类测试定义为腐烂绿色测试并研究其检测。
方法
结合静态与动态调用点分析识别未执行的断言,处理测试辅助方法、继承辅助方法和 trait 组合,并实现 DrTest 工具。
评估
在 Pharo 生态 19,905 个真实测试用例上实证评估;DrTest 无假阴性但存在少量假阳性,检测出 294 个腐烂测试,部分已存在至少 5 年。
原文摘要(Abstract)

Unit tests are a tenant of agile programming methodologies, and are widely used to improve code quality and prevent code regression. A green (passing) test is usually taken as a robust sign that the code under test is valid. However, some green tests contain assertions that are never executed. We call such tests Rotten Green Tests. Rotten Green Tests represent a case worse than a broken test: they report that the code under test is valid, but in fact do not test that validity. We describe an approach to identify rotten green tests by combining simple static and dynamic call-site analyses. Our approach takes into account test helper methods, inherited helpers, and trait compositions, and has been implemented in a tool called DrTest. DrTest reports no false negatives, yet it still reports some false positives due to conditional use or multiple test contexts. Using DrTest we conducted an empirical evaluation of 19,905 real test cases in mature projects of the Pharo ecosystem. The results of the evaluation show that the tool is effective; it detected 294 tests as rotten—green tests that contain assertions that are not executed. Some rotten tests have been “sleeping” in Pharo for at least 5 years.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{DelplanqueDPBE19,
  title = {Rotten Green Tests},
  author = {Julien Delplanque and Stephane Ducasse and Guillermo Polito and Andrew P. Black and Anne Etien},
  booktitle = {ICSE},
  year = {2019},
  doi = {10.1109/icse.2019.00062}
}