SAGA: Summarization-Guided Assert Statement Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Yuwei, Jin, Zhi, Wang, Zejun, Xing, Ying, Li, Ge
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910301789618176
author Zhang, Yuwei
Jin, Zhi
Wang, Zejun
Xing, Ying
Li, Ge
author_facet Zhang, Yuwei
Jin, Zhi
Wang, Zejun
Xing, Ying
Li, Ge
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2305_14808
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle SAGA: Summarization-Guided Assert Statement Generation
Zhang, Yuwei
Jin, Zhi
Wang, Zejun
Xing, Ying
Li, Ge
Software Engineering
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.
title SAGA: Summarization-Guided Assert Statement Generation
topic Software Engineering
url https://arxiv.org/abs/2305.14808