On the co-occurrence of refactoring of test and source code
Authors:
Open Access
- 23 May 2022
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 122-126
Abstract
Refactoring is a widespread practice that aims to help improve the quality of a software system without altering its external behaviour. In practice, developers can perform refactoring operations on test and source code. However, while prior work showed that refactoring source code brings many benefits, few studies investigated test code refactoring and whether it co-occurred with source code. To examine the co-occurring refactorings, we conducted an empirical study of 60,465 commits spanning 77 open-source Java projects. First, we quantitatively analyzed the commits from those projects to identify co-occurring refactoring commits (i.e., commits contain refactorings performed on test and source code). Our results showed that on average 17.9% of refactoring commits are co-occurring refactoring commits, which is twice as much as test code-only refactoring commits. Also, we investigated the type of refactorings applied to test code in those co-occurring commits. We found Change Variable Type and Move Class are the most common applied refactorings. Second, we trained random forest classifiers to predict when refactoring test code should co-occur with refactoring source code using features extracted from the refactoring source code in ten selected projects. Our results showed that the classifier can accurately predict when test and source code refactoring co-occurs with AUC values between 0.67--0.92. Our analysis also showed that the most important features in our classifiers are related the refactoring size and developer refactoring experience.Keywords
This publication has 15 references indexed in Scilit:
- Toward the automatic classification of Self-Affirmed RefactoringJournal of Systems and Software, 2021
- RefactoringMiner 2.0IEEE Transactions on Software Engineering, 2020
- RefDiff 2.0: A Multi-Language Refactoring Detection ToolIEEE Transactions on Software Engineering, 2020
- Why we refactor? confessions of GitHub contributors2016
- An empirical investigation into the nature of test smells2016
- Are test smells really harmful? An empirical studyEmpirical Software Engineering, 2014
- Refactoring Test Code Safely2007
- A survey of software refactoringIEEE Transactions on Software Engineering, 2004
- SMOTE: Synthetic Minority Over-sampling TechniqueJournal of Artificial Intelligence Research, 2002
- Estimating the Error Rate of a Prediction Rule: Improvement on Cross-ValidationJournal of the American Statistical Association, 1983