Lune

Abstract

Writing tests is a time-consuming yet essential task during software development. We propose to leverage recent advances in deep learning for text and code generation to assist developers in writing tests. We formalize the novel task of test completion to automatically complete the next statement in a test method based on the context of prior statements and the code under test. We develop TECo-a deep learning model using code semantics for test completion. The key insight underlying TECO is that predicting the next statement in a test method requires reasoning about code execution, which is hard to do with only syntax-level data that existing code completion models use. Teco extracts and uses six kinds of code semantics data, including the execution result of prior statements and the execution context of the test method. To provide a testbed for this new task, as well as to evaluate TECO, we collect a corpus of 130,934 test methods from 1,270 open-source Java projects. Our results show that Teco achieves an exact-match accuracy of 18, which is 29% higher than the best baseline using syntax-level data only. When measuring functional correctness of generated next statement, Teco can generate runnable code in 29% of the cases compared to 18% obtained by the best baseline. Moreover, Teco is sianificantly better than prior work on test oracle generation.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

29 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Evaluating and Improving ChatGPT for Unit Test Generation cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Evaluating and Improving ChatGPT for Unit Test Generation cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Evaluating and Improving ChatGPT for Unit Test Generation cites Fuzz4All: Universal Fuzzing with Large Language Models
  • Evaluating and Improving ChatGPT for Unit Test Generation cites Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models
  • Evaluating and Improving ChatGPT for Unit Test Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation cites BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models cites Fuzz4All: Universal Fuzzing with Large Language Models
  • WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models cites Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models
  • WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Fuzz4All: Universal Fuzzing with Large Language Models cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Fuzz4All: Universal Fuzzing with Large Language Models cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Fuzz4All: Universal Fuzzing with Large Language Models cites Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models
  • Fuzz4All: Universal Fuzzing with Large Language Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware Decisions cites CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
  • Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware Decisions cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers29

  1. Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language ModelsYinlin Deng, Chunqiu Steven Xia, Haoran Peng, Chenyuan Yang et al.ISSTA 2023 · 253 citations
  2. Fuzz4All: Universal Fuzzing with Large Language ModelsChunqiu Steven Xia, Matteo Paltenghi, Jia Le Tian, Michael Pradel et al.ICSE 2024 · 155 citations
  3. Evaluating and Improving ChatGPT for Unit Test GenerationZhiqiang Yuan, Mingwei Liu, Shiji Ding, Kaixin Wang et al.FSE 2024 · 89 citations
  4. Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware DecisionsZhe Liu, Chunyang Chen, Junjie Wang, Mengzhuo Chen et al.ICSE 2024 · 81 citations
  5. WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language ModelsChenyuan Yang, Yinlin Deng, Runyu Lu, Jiayi Yao et al.OOPSLA 2024 · 74 citations

Builds on22

  1. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
  2. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  3. BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and ComprehensionMike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad et al.ACL 2020 · 1,224 citations
  4. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
  5. CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language ModelsCaroline Lemieux, Jeevana Priya Inala, Shuvendu K. Lahiri, Siddhartha SenICSE 2023 · 221 citations

Related papers

  1. TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 citations
  2. CAT-LM Training Language Models on Aligned Code And TestsNikitha Rao, Kush Jain, Uri Alon, Claire Le Goues et al.ASE 2023 · 37 citations
  3. Domain Adaptation for Code Model-Based Unit Test Case GenerationJiho Shin, Sepehr Hashtroudi, Hadi Hemmati, Song WangISSTA 2024 · 21 citations
  4. DeepTC-Enhancer: Improving the Readability of Automatically Generated TestsDevjeet Roy, Ziyi Zhang, Maggie Ma, Venera Arnaoudova et al.ASE 2020 · 32 citations
  5. Perfect is the enemy of test oracleAli Reza Ibrahimzada, Yigit Varli, Dilara Tekinoglu, Reyhaneh JabbarvandFSE 2022 · 23 citations
Dusk over the sea between two cliffs drawn in fine vertical lines