SAGA:摘要引导的断言语句生成
SAGA: Summarization-Guided Assert Statement Generation
AI总结:
针对断言语句生成依赖测试前缀和焦点方法而忽略开发者摘要的问题,本文提出SAGA,利用预训练语言模型融合摘要信息并微调,以提升断言生成准确性。
摘要:
生成有意义的断言语句是自动化测试用例生成中的关键挑战之一,这需要理解被测代码的预期功能。近年来,基于深度学习的模型在提升断言语句生成性能方面展现出潜力。然而,现有模型仅依赖测试前缀及其对应的焦点方法,却忽略了开发者编写的摘要。根据我们的观察,摘要内容通常表达预期的程序行为,或包含将直接出现在断言语句中的参数。此类信息有助于现有模型解决其目前无法准确预测断言语句的问题。本文提出了一种新颖的摘要引导方法,用于自动生成断言语句。为了获得自然语言(即摘要)和编程语言(即测试前缀与焦点方法)的通用表示,我们利用预训练语言模型作为参考架构,并在断言语句生成任务上对其进行微调。据我们所知,所提出的方法首次尝试利用焦点方法的摘要作为引导,使生成的断言语句更加准确。与最先进模型相比,我们在两个真实世界数据集上证明了该方法的有效性。
英文摘要:
Generating meaningful assert statements is one of the key challenges in automated test case generation, which requires understanding the intended functionality of the tested code. Recently, deep learning-based models have shown promise in improving the performance of assert statement generation. However, existing models only rely on the test prefixes along with their corresponding focal methods, yet ignore the developer-written summarization. Based on our observations, the summarization contents usually express the intended program behavior or contain parameters that will appear directly in the assert statement. Such information will help existing models address their current inability to accurately predict assert statements. This paper presents a novel summarization-guided approach for automatically generating assert statements. To derive generic representations for natural language (i.e., summarization) and programming language (i.e., test prefixes and focal methods), we leverage a pre-trained language model as the reference architecture and fine-tune it on the task of assert statement generation. To the best of our knowledge, the proposed approach makes the first attempt to leverage the summarization of focal methods as the guidance for making the generated assert statements more accurate. We demonstrate the effectiveness of our approach on two real-world datasets when compared with state-of-the-art models.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。