paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Revisiting and Improving Retrieval-Augmented Deep Assertion Generation

重新审视与改进检索增强的深度断言生成
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 3/10 · 论文聚焦单元测试断言生成,属于机器学习与程序语言交叉,但未涉及用户核心关注的静态分析、形式化验证、浮点程序分析或贝叶斯程序分析,也未使用LLM/Agent,与当前研究画像匹配度较低。引用 19 inbox
Weifeng Sun, Hongyan Li, Meng Yan, Yan Lei, Hongyu Zhang
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:分析检索增强断言生成的局限,提出自动编辑原型的 EDITAS,显著提升断言生成性能。

单元测试中手动编写断言成本高,已有工作将信息检索与深度学习结合(integration)生成断言,但其有效性与失败原因尚不明确。本文深入分析发现:integration 的性能主要来自成功检索断言,但因难以理解检索到的 focal-test 与输入的语义差异而错误修改大量 token,且仅支持替换操作,无法处理增删。为此提出检索-编辑方法 EDITAS:先检索相似 focal-test 并将其断言作为原型,再自动编辑原型,从而更全面地理解语义差异、灵活应用编辑模式并生成更丰富的编辑动作。在两个大规模数据集上,其准确率较 SOTA 提升 10.00%-87.48%,BLEU 提升 3.30%-42.65%。

问题
现有检索增强的深度断言生成方法(integration)虽有效,但缺乏对其成功与失败原因的分析,尤其难以处理检索样本与输入 focal-test 的语义差异及增删 token 的编辑。
方法
对 integration 进行实证分析,并提出检索-编辑式断言生成方法 EDITAS,通过检索相似 focal-test 的断言作为原型并自动执行灵活编辑。
评估
在两个大规模数据集上与当前最优方法对比,报告准确率与 BLEU 的提升。
原文摘要(Abstract)

Unit testing validates the correctness of the unit under test and has become an essential activity in software development process. A unit test consists of a test prefix that drives the unit under test into a particular state, and a test oracle (e.g., assertion), which specifies the behavior in that state. To reduce manual efforts in conducting unit testing, Yu et al. proposed an integrated approach (integration for short), combining information retrieval with a deep learning-based approach, to generate assertions for a unit test. Despite being promising, there is still a knowledge gap as to why or where integration works or does not work. In this paper, we describe an in-depth analysis of the effectiveness of integration. Our analysis shows that: ① The overall performance of integration is mainly due to its success in retrieving assertions. ② integration struggles to understand the semantic differences between the retrieved focal-test (focal-test includes a test prefix and a unit under test) and the input focal-test, resulting in many tokens being incorrectly modified; ③ integration is limited to specific types of edit operations (i.e., replacement) and cannot handle token addition or deletion. To improve the effectiveness of assertion generation, this paper proposes a novel retrieve-and-edit approach named EDITAS. Specifically, Editas first retrieves a similar focal-test from a pre-defined corpus and treats its assertion as a prototype. Then, Editas reuses the information in the prototype and edits the prototype automatically. Editas is more generalizable than integration because it can ❶ comprehensively understand the semantic differences between input and similar focal-tests; ❷ apply appropriate assertion edit patterns with greater flexibility; and ❸ generate more diverse edit actions than just replacement operations. We conduct experiments on two large-scale datasets and the experimental results demonstrate that Editas outperforms the state-of-the-art approaches, with an average improvement of 10.00%-87.48% and 3.30%-42.65% in accuracy and BLEU score, respectively.

链接与引用

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

BibTeX
@inproceedings{abs-2309-10264,
  title = {Revisiting and Improving Retrieval-Augmented Deep Assertion Generation},
  author = {Weifeng Sun and Hongyan Li and Meng Yan and Yan Lei and Hongyu Zhang},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00090}
}