paperbot · PL 论文追踪

全部论文 待读 收藏

P2 FailMapper: Automated Generation of Unit Tests Guided by Failure Scenarios

FailMapper:由失败场景引导的单元测试自动生成
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 2/10 · 该论文属于自动化单元测试生成与缺陷检测,虽涉及程序分析与搜索(MCTS),但不涉及用户核心关注的静态分析、形式化验证、LLM/Agent 与程序分析交叉、浮点程序分析或贝叶斯程序分析。引用 1 inbox
Ruiqi Dong, Zehang Deng, Xiaogang Zhu, Xiaoning Du, Huai Liu, Shaohua Wang, Sheng Wen, Yang Xiang
crossref: 2026-09-12

AI 速览

一句话:提出 FailMapper,用九类失败场景和 MCTS 引导单元测试生成,显著提升缺陷触发能力。

现有单元测试生成多追求高代码覆盖率,但高覆盖未必能有效发现缺陷;而按缺陷属性引导又受缺陷类型多样限制。本文观察到失败作为缺陷结果仅呈现有限场景,提出 FailMapper:总结九类失败场景并设计对应失败触发测试策略,并用蒙特卡洛树搜索(MCTS)探索可能导致失败的故障,以生成更易触发缺陷的测试。实验在 Defects4J 的 50 个已知缺陷上检出 40 个,远超 EvoSuite、Randoop、CoverUp、HITS、SymPrompt 的最多 12 个;在 GitBug-Java 与 Bears 的 20 个缺陷中检出 12 个,并从两个 Apache 项目报告 36 个潜在问题,其中 14 个已确认。

问题
现有单元测试生成以覆盖率最大化为目标,但高覆盖不等于能有效发现缺陷;直接依据缺陷属性引导测试又因缺陷类型繁多而难以全面刻画。
方法
FailMapper 归纳九类失败场景并设计相应失败触发策略,使用蒙特卡洛树搜索探索可能导致失败的程序故障,以指导单元测试生成。
评估
在 Defects4J 的 50 个已知缺陷上检出 40 个(对比方法最多 12 个),在 GitBug-Java 与 Bears 的 20 个缺陷中检出 12 个,并从两个 Apache 项目报告 36 个潜在问题(14 个已确认)。
原文摘要(Abstract)

The automation of unit test generation has become a critical task for improving the overall efficiency of software development and testing. Many existing techniques attempt to generate a sufficient number of test cases to achieve high code coverage. However, it has been shown that a high coverage does not necessarily guarantee effective bug discovery. A potential enhancement is to guide the unit test generation based on bug properties. However, this solution is challenged by the large number and diversity of bug types, making it difficult to comprehensively summarize bug properties.We observe that failures, presented as the results of bugs, manifest in a limited number of scenarios. Therefore, instead of bug properties, in this paper, we propose an innovative framework, named FailMapper, which uses failure scenarios to guide the generation of unit tests. We summarize nine failure scenarios and design the corresponding failure-triggering test strategies. This significantly improves the efficacy of generating test cases towards triggering bugs. To systematically explore possible failure scenarios, FailMapper employs the Monte Carlo Tree Search algorithm to search for the faults that may lead to a failure. Experiments demonstrate that, on 50 known bugs in the Defects4J benchmark, FailMapper can detect many more bugs than five typical unit testing approaches, including EvoSuite, Randoop, CoverUp, HITS, and SymPrompt (40 versus at most 12, out of all 50 bugs). Meanwhile, FailMapper detects 12 out of 20 bugs in the GitBug-Java and Bears-benchmark datasets. We reveal 36 potential issues from 2 Apache projects, and 14 of them have been confirmed as bugs, further demonstrating FailMapper’s effectiveness. The experimental results show that our new framework can significantly enhance the overall efficacy of unit testing.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9452,
  title = {FailMapper: Automated Generation of Unit Tests Guided by Failure Scenarios},
  author = {Ruiqi Dong and Zehang Deng and Xiaogang Zhu and Xiaoning Du and Huai Liu and Shaohua Wang and Sheng Wen and Yang Xiang},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00197}
}