Learning Deep Semantics for Test Completion
Pengyu Nie, Rahul Banerjee, Junyi Jessy Li, Raymond J. Mooney, Milos Gligoric
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 29 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- Evaluating and Improving ChatGPT for Unit Test Generation 引用了 Fuzz4All: Universal Fuzzing with Large Language Models
- Evaluating and Improving ChatGPT for Unit Test Generation 引用了 Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models
- Evaluating and Improving ChatGPT for Unit Test Generation 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation 引用了 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 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models 引用了 Fuzz4All: Universal Fuzzing with Large Language Models
- WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language Models 引用了 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 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Fuzz4All: Universal Fuzzing with Large Language Models 引用了 CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language Models
- Fuzz4All: Universal Fuzzing with Large Language Models 引用了 CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
- Fuzz4All: Universal Fuzzing with Large Language Models 引用了 Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Models
- Fuzz4All: Universal Fuzzing with Large Language Models 引用了 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 引用了 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 引用了 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 引用了 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 引用了 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 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
引用它的顶会 Paper29
- Large Language Models Are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language ModelsYinlin Deng, Chunqiu Steven Xia, Haoran Peng, Chenyuan Yang 等ISSTA 2023 · 253 次引用
- Fuzz4All: Universal Fuzzing with Large Language ModelsChunqiu Steven Xia, Matteo Paltenghi, Jia Le Tian, Michael Pradel 等ICSE 2024 · 155 次引用
- Evaluating and Improving ChatGPT for Unit Test GenerationZhiqiang Yuan, Mingwei Liu, Shiji Ding, Kaixin Wang 等FSE 2024 · 89 次引用
- Make LLM a Testing Expert: Bringing Human-like Interaction to Mobile GUI Testing via Functionality-aware DecisionsZhe Liu, Chunyang Chen, Junjie Wang, Mengzhuo Chen 等ICSE 2024 · 81 次引用
- WhiteFox: White-Box Compiler Fuzzing Empowered by Large Language ModelsChenyuan Yang, Yinlin Deng, Runyu Lu, Jiayi Yao 等OOPSLA 2024 · 74 次引用
它引用的 Paper22
- Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo 等NeurIPS 2022 · 8,168 次引用
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and ComprehensionMike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad 等ACL 2020 · 1,224 次引用
- 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 次引用
- CodaMosa: Escaping Coverage Plateaus in Test Generation with Pre-trained Large Language ModelsCaroline Lemieux, Jeevana Priya Inala, Shuvendu K. Lahiri, Siddhartha SenICSE 2023 · 221 次引用
相关 Paper
- TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 次引用
- CAT-LM Training Language Models on Aligned Code And TestsNikitha Rao, Kush Jain, Uri Alon, Claire Le Goues 等ASE 2023 · 37 次引用
- Domain Adaptation for Code Model-Based Unit Test Case GenerationJiho Shin, Sepehr Hashtroudi, Hadi Hemmati, Song WangISSTA 2024 · 21 次引用
- DeepTC-Enhancer: Improving the Readability of Automatically Generated TestsDevjeet Roy, Ziyi Zhang, Maggie Ma, Venera Arnaoudova 等ASE 2020 · 32 次引用
- Perfect is the enemy of test oracleAli Reza Ibrahimzada, Yigit Varli, Dilara Tekinoglu, Reyhaneh JabbarvandFSE 2022 · 23 次引用
