paper-with-me

홈 › Papers

Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformers

2020-09-11 · Michele Tufano, Dawn Drain, Alexey Svyatkovskiy, Neel Sundaresan

Unit testing represents the foundational basis of the software testing pyramid, beneath integration and end-to-end testing. Automated software testing researchers have proposed a variety of techniques to assist developers in this time-consuming task. In this paper we present an approach to support developers in writing unit test cases by generating accurate and useful assert statements. Our approach is based on a state-of-the-art transformer model initially pretrained on an English textual corpus. This semantically rich model is then trained in a semi-supervised fashion on a large corpus of source code. Finally, we finetune this model on the task of generating assert statements for unit tests. The resulting model is able to generate accurate assert statements for a given method under test. In our empirical evaluation, the model was able to predict the exact assert statements written by developers in 62% of the cases in the first attempt. The results show 80% relative improvement for top-1 accuracy over the previous RNN-based approach in the literature. We also show the substantial impact of the pretraining process on the performances of our model, as well as comparing it with assert auto-completion task. Finally, we demonstrate how our approach can be used to augment EvoSuite test cases, with additional asserts leading to improved test coverage.

📄 PDF Abstract BibTeX arXiv:2009.05634

Code (0)

등록된 구현이 없습니다.

Tasks

software testing

Similar Papers 제목 키워드 기반

ConTest: A Unit Test Completion Benchmark featuring Context

2021-08-01 · ACL (NLP4Prog) 2021 8 · Johannes Villmow, Jonas Depoix, Adrian Ulges

We introduce CONTEST, a benchmark for NLP-based unit test completion, the task of predicting a test’s assert statements given its setup and focal method, i.e. the method to be tested. ConTest is large-scale (with 365k da…

ReAssert: Deep Learning for Assert Generation

2020-11-19 · Robert White, Jens Krinke

The automated generation of test code can reduce the time and effort required to build software while increasing its correctness and robustness. In this paper, we present RE-ASSERT, an approach for the automated generati…

Deep Learning

ASSERTIFY: Utilizing Large Language Models to Generate Assertions for Production Code

2024-11-25 · Mohammad Jalili Torkamani, Abhinav Sharma, Nikita Mehrotra, Rahul Purandare

Production assertions are statements embedded in the code to help developers validate their assumptions about the code. They assist developers in debugging, provide valuable documentation, and enhance code comprehension.…

Few-Shot LearningPrompt Engineering

Unit Test Generation using Generative AI : A Comparative Performance Analysis of Autogeneration Tools

2023-12-17 · Shreya Bhatia, Tarushi Gandhi, Dhruv Kumar, Pankaj Jalote

Generating unit tests is a crucial task in software development, demanding substantial time and effort from programmers. The advent of Large Language Models (LLMs) introduces a novel avenue for unit test script generatio…

Prompt EngineeringScript Generation

Test-Driven Development for Code Generation

2024-02-21 · Noble Saji Mathews, Meiyappan Nagappan

Recent Large Language Models (LLMs) have demonstrated significant capabilities in generating code snippets directly from problem statements. This increasingly automated process mirrors traditional human-led software deve…

Code GenerationHumanEvalmbpptest driven development