Chat-like Asserts Prediction with the Support of Large Language Model
Han Wang, Han Hu, Chunyang Chen, Burak Turhan

TL;DR
This paper introduces ool, a Large Language Model-based method for generating meaningful assert statements in Python unit tests, achieving high accuracy and outperforming existing approaches by leveraging innovative prompt design and interaction techniques.
Contribution
The paper presents a novel LLM-based approach for assert statement generation in Python, including a new dataset and techniques like persona, Chain-of-Thought, and one-shot learning.
Findings
Achieves 64.7% accuracy in single assert statement generation
Outperforms existing methods in overall assert statement accuracy
Provides analysis of mismatched asserts sharing functionality
Abstract
Unit testing is an essential component of software testing, with the assert statements playing an important role in determining whether the tested function operates as expected. Although research has explored automated test case generation, generating meaningful assert statements remains an ongoing challenge. While several studies have investigated assert statement generation in Java, limited work addresses this task in popular dynamically-typed programming languages like Python. In this paper, we introduce Chat-like execution-based Asserts Prediction (\tool), a novel Large Language Model-based approach for generating meaningful assert statements for Python projects. \tool utilizes the persona, Chain-of-Thought, and one-shot learning techniques in the prompt design, and conducts rounds of communication with LLM and Python interpreter to generate meaningful assert statements. We also…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling
