paperbot · PL 论文追踪

全部论文 待读 收藏

P2 What You See is What You Get: Attention-Based Self-Guided Automatic Unit Test Generation

所见即所得:基于注意力的自引导自动单元测试生成
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 2/10 · 该论文属于基于机器学习/注意力的缺陷检测与自动单元测试生成,偏软件测试与调试,并非用户核心关注的静态分析、形式化验证、Agentic 程序分析或浮点/贝叶斯程序分析。虽然涉及 ML 与程序语言的交叉,但方法与问题都不在用户研究画像的核心方向上。引用 11 inbox
Xin Yin, Chao Ni, Xiaodan Xu, Xiaohu Yang
crossref: 2026-09-12

AI 速览

一句话:提出注意力自引导的两阶段方法AUGER,先预测缺陷再生成触发错误的单元测试,提升检测与触发效果。

软件缺陷会严重影响功能并造成损失。已有AI方法分为缺陷预测与自动单元测试生成,但存在预测置信度低、单元测试模型效率不高等问题。为此,作者提出WYSIWYG式方法AUGER,包含缺陷检测与错误触发两个阶段:先检测代码的缺陷倾向,再利用该阶段获得的关键信息自引导地生成能触发该错误的单元测试。评估在Bears、Bugs.jar和Defects4J上与SOTA比较,缺陷检测F1提升4.7%至35.3%,Precision提升17.7%至40.4%,单元测试生成可多触发23至84个错误;并用真实项目新数据集验证泛化性。

问题
已有AI缺陷检测方法存在缺陷预测置信度低、自动单元测试生成效率不足的问题,难以在实际中可靠触发缺陷。
方法
提出AUGER,采用两阶段注意力自引导流程:先进行缺陷检测,再利用检测阶段的关键信息指导生成可触发错误的单元测试。
评估
在Bears、Bugs.jar、Defects4J等常用数据集上与SOTA方法进行大规模对比,并收集真实项目新数据集验证泛化性;缺陷检测F1和Precision显著提升,单元测试触发错误数更多。
原文摘要(Abstract)

Software defects heavily affect software's function-alities and may cause huge losses. Recently, many AI-based approaches have been proposed to detect defects, which can be divided into two categories: software defect prediction and automatic unit test generation. While these approaches have made great progress in software defect detection, they still have several limitations in practical application, including the low confidence of prediction models and the inefficiency of unit testing models. To address these limitations, we propose a WYSIWYG (i.e., What You See Is What You Get) approach: Attention-based Self-guided Automatic Unit Test GenERation (AUGER), which contains two stages: defect detection and error triggering. In the former stage, AUGER first detects the proneness of defects. Then, in the latter stage, it guides to generate unit tests for triggering such an error with the help of critical information obtained by the former stage. To evaluate the effectiveness of AUGER, we conduct a large-scale experiment by comparing with the state-of-the-art (SOTA) approaches on the widely used datasets (i.e., Bears, Bugs.jar, and Defects4J). AUGER makes great improvements by 4.7% to 35.3% and 17.7% to 40.4% in terms of Fl-score and Precision in defect detection, and can trigger 23 to 84 more errors than SOTAs in unit test generation. Besides, we also conduct a further study to verify the generalization in practical usage by collecting a new dataset from real-world projects.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8716,
  title = {What You See is What You Get: Attention-Based Self-Guided Automatic Unit Test Generation},
  author = {Xin Yin and Chao Ni and Xiaodan Xu and Xiaohu Yang},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00105}
}