• Home
  • Search
  • Exploring and Improving Code Completion for Test Code
  • Cite Icon4
  • https://doi.org/10.1145/3643916.3644421Copy DOI Icon

Exploring and Improving Code Completion for Test Code

  • Apr 15, 2024
  • Tingwei Zhu +6 more
Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

Code completion is an important feature in Integrated Development Environments (IDEs). These years, researchers have been making efforts for intelligent code completion. However, existing work on intelligent code completion either only considered production code, or did not distinguish between production code and test code. It is unclear how effective existing completion models are for test code completion, nor whether we can further improve it. In this work, we focus on the completion of test code. We first find through experiments that completion models for production code are suboptimal for test code completion. Then we analyze the specific characteristics of test code, and observe that test code has inter- and intra-project similarities, and a strong relationship with its focal class and other production classes depending on the focal class (i.e., focal-related code). By incorporating test code from other projects to fine-tune existing models, we leverage the inter-project similarity of test code to improve the completion of tokens specific to test code. By introducing a local component and constructing existing test code as well as the focal-related code in the project as references, we enhance existing code completion models with the intra-project similarity and the focal-related code of test code. Experiments show that each characteristic of test code we exploit can bring substantial improvement to test code completion and our integrated framework outperforms other baseline frameworks. Compared to the base completion model, on token-level completion, our optimal model for test code completion relatively improves all-token and identifier completion accuracy by 7.68% and 19.96%, respectively; on line-level completion, it relatively improves edit-distance similarity and exact-match metrics by 8.89% and 22.82%, respectively. Moreover, we perform error analysis and point out potential directions for future work.

Similar Papers
  • Research Article
  • Citations2

Towards automatically identifying the co‐change of production and test code

  • Jan 11, 2024
  • Software Testing, Verification and Reliability
  • Yuan Huang +3
  • Research Article
  • Citations17

Revisiting the Identification of the Co-evolution of Production and Test Code

  • Sep 30, 2023
  • ACM Transactions on Software Engineering and Methodology
  • Weifeng Sun +5
  • Conference Article
  • Citations63

Studying Fine-Grained Co-evolution Patterns of Production and Test Code

  • Sep 01, 2014
  • Cosmin Marsavina +2
  • Research Article
  • Citations3

Exploring the Impact of Vocabulary Techniques on Code Completion: A Comparative Approach

  • Jan 13, 2024
  • International Journal of Software Engineering and Knowledge Engineering
  • Yasir Hussain +3
  • Conference Article
  • Citations2

Practices and tools for better software testing

  • Oct 26, 2018
  • Davide Spadini
  • Conference Article
  • Citations5

A Comparative Study of Code Clone Genealogies in Test Code and Production Code

  • Mar 01, 2023
  • Brent Van Bladel +1
  • Conference Article
  • Citations169

Multi-task learning based pre-trained language model for code completion

  • Dec 21, 2020
  • Fang Liu +3
  • Conference Article
  • Citations10

A study on repetitiveness of code completion operations

  • Sep 01, 2012
  • Takayuki Omori +2
  • Research Article
  • Citations77

Code Completion by Modeling Flattened Abstract Syntax Trees as Graphs

  • May 18, 2021
  • Proceedings of the AAAI Conference on Artificial Intelligence
  • Yanlin Wang +1
  • Conference Article
  • Citations10

Mutation testing as a safety net for test code refactoring

  • May 25, 2015
  • Ali Parsai +3
  • Conference Article
  • Citations3

A Two Phase Smart Code Editor

  • Jun 11, 2021
  • 2021 3rd International Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA)
  • Melike Serra Kalyon +1
  • Conference Article
  • Citations84

A Self-Attentional Neural Architecture for Code Completion with Multi-Task Learning

  • Jul 13, 2020
  • Fang Liu +5
  • Conference Article
  • Citations2

A retrospective of production and test code co-evolution in an industrial project

  • Mar 01, 2018
  • Claus Klammer +2
  • Conference Article
  • Citations1

Assessing the complexity of upgrading software modules

  • Oct 01, 2013
  • Bram Schoenmakers +4
  • Research Article
  • Citations1

An Empirical Study on Language Models for Generating Log Statements in Test Code

  • Aug 12, 2025
  • ACM Transactions on Software Engineering and Methodology
  • Honglin Shu +4
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.