mlsanityData to 7 Oct 2026

Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformers

arXiv 2009.05634 ↗First posted 11 Sep 2020cs.SE cs.LGcited by 30

Not on the map. Why?

Abstract (arXiv)

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.

Key facts. Cited by 30 papers in the map (data through 7 Oct 2026). First posted on arXiv 11 Sep 2020.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2021: 3; 2022: 4; 2023: 7; 2024: 4; 2025: 7; 2026: 5.

30 papers.

Sort:

By area:

  1. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
  2. 2023Planning with Large Language Models for Code Generationcited by 179
  3. 2023Can Large Language Models Transform Natural Language Intent into Formal Method Postconditions?cited by 53
  4. 2022Interactive Code Generation via Test-Driven User-Intent Formalizationcited by 50
  5. 2021What do pre-trained code models know about code?cited by 36
  6. 2022Training and Evaluating a Jupyter Notebook Data Science Assistantcited by 31
  7. 2021Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchycited by 14
  8. 2024B4: Towards Optimal Assessment of Plausible Code Solutions with Plausible Testscited by 9
  9. 2023Domain Adaptation for Code Model-based Unit Test Case Generationcited by 7
  10. 2023Assessing Evaluation Metrics for Neural Test Oracle Generationcited by 7
  11. 2022On The Cross-Modal Transfer from Natural Language to Code through Adapter Modulescited by 6
  12. 2023Perfect is the enemy of test oraclecited by 6
18 more
  1. 2023Revisiting and Improving Retrieval-Augmented Deep Assertion Generationcited by 5
  2. 2025Beyond Postconditions: Can Large Language Models infer Formal Contracts for Automatic Software Verification?cited by 5
  3. 2025Generative AI for Self-Adaptive Systems: State of the Art and Research Roadmapcited by 5
  4. 2024exLong: Generating Exceptional Behavior Tests with Large Language Modelscited by 4
  5. 2024CodeSift: An LLM-Based Reference-Less Framework for Automatic Code Validationcited by 4
  6. 2025Improving Deep Assertion Generation via Fine-Tuning Retrieval-Augmented Pre-trained Language Modelscited by 4
  7. 2022AdaptivePaste: Code Adaptation through Learning Semantics-aware Variable Usage Representationscited by 3
  8. 2024LLMs in the Heart of Differential Testing: A Case Study on a Medical Rule Enginecited by 2
  9. 2025Improving Retrieval-Augmented Deep Assertion Generation via Joint Trainingcited by 2
  10. 2025Large Language Models for Software Testing: A Research Roadmapcited by 2
  11. 2026Understanding LLM-Driven Test Oracle Generationcited by 2
  12. 2026SpecMind: Cognitively Inspired, Interactive Multi-Turn Framework for Postcondition Inferencecited by 2
  13. 2025Static Program Analysis Guided LLM Based Unit Test Generationcited by 1
  14. 2026Teaching Code LLMs to Reason with Intermediate Formal Specificationscited by 1
  15. 2026SCATE: Learning to Supervise Coding Agents for Cost-Effective Test Generationcited by 1
  16. 2021Embedding Code Contexts for Cryptographic API Suggestion:New Methodologies and Comparisonscited by 0
  17. 2025CUBETESTERAI: Automated JUnit Test Generation using the LLaMA Modelcited by 0
  18. 2026Fail-Aware and Explainable Test Oracle Predictioncited by 0