paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Rotten Green Tests in Google Test

Google Test 中的腐烂绿色测试
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 3/10 · 该论文聚焦软件测试领域,增强Google Test检测腐烂绿色测试,属于软件工程与测试,与用户关注的PL与AI交叉(静态分析、LLM/Agent)、浮点程序分析及贝叶斯程序分析无直接关联,未涉及LLM或静态分析技术。虽然具有工业落地和问题驱动特点,但研究方向不匹配。引用 1 inbox
Paul T. Robinson
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:增强 Google Test 以自动检测未真正执行断言、却报告通过的腐烂绿色测试。

可执行单元测试广泛用于软件工程,但测试框架常把未报告失败等同于通过。若测试看似执行了有用断言,实际却未运行任何断言,便形成“腐烂绿色测试”。本文在流行的 C++ 测试框架 Google Test 中实现腐烂绿色测试检测,沿用 Pharo 的类似工作思路,但面向工业实践,且无需修改测试代码或引入外部工具。增强后的 Google Test 在 LLVM 项目单元测试中检测到 183 个腐烂断言,并在 Google Test 自身内部测试套件中发现 1 个。方法对参数化测试中依赖参数条件的断言可能误报,且目前无法检测辅助方法中的腐烂断言。

问题
单元测试常被假定为通过,但实际可能未执行任何有效断言,即腐烂绿色测试;现有检测多限于研究语言或需修改测试、引入外部工具。
方法
在 Google Test 框架中增强检测机制,无需修改测试代码或外部工具,即可识别未执行的断言。
评估
在 LLVM 单元测试中发现 183 个腐烂断言,并在 Google Test 自身测试中发现 1 个;同时报告参数化测试误报与辅助方法未覆盖的限制。
原文摘要(Abstract)

Executable unit tests are a key component of many software engineering methodologies. A “green” test is one that is reported as passing (successfully testing some software feature). However, it is common for a test harness to assume that a test has passed when, in fact, it has merely not reported a failure. In this gap, where the “excluded middle” lives and thrives, we find the Rotten Green Test: A test that looks like it does something useful, but in fact does not. Google Test, a popular open-source test framework for C++ software, has been enhanced to detect rotten green tests. This enhancement follows the lead of similar work done for the Pharo language, but in a framework more applicable in industry, and with no requirement for test modifications or an external tool. The enhanced Google Test has detected 183 rotten assertions in the LLVM project’s unit tests, and even found one in Google Test’s own internal test suite. The enhancement may report false positives from parameterized tests where assertions are conditioned on the parameter, and currently does not detect rotten assertions in helper methods.

链接与引用

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

BibTeX
@inproceedings{Robinson23,
  title = {Rotten Green Tests in Google Test},
  author = {Paul T. Robinson},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3613865}
}