Testability Refactoring in Pull Requests: Patterns and Trends

03/24/2023
by   Pavel Reich, et al.
0

To create unit tests, it may be necessary to refactor the production code, e.g. by widening access to specific methods or by decomposing classes into smaller units that are easier to test independently. We report on an extensive study to understand such composite refactoring procedures for the purpose of improving testability. We collected and studied 346,841 java pull requests from 621 GitHub projects. First, we compared the atomic refactorings in two populations: pull requests with changed test-pairs (i.e. with co-changes in production and test code and thus potentially including testability refactoring) and pull requests without test-pairs. We found significantly more atomic refactorings in test-pairs pull requests, such as Change Variable Type Operation or Change Parameter Type. Second, we manually analyzed the code changes of 200 pull requests, where developers explicitly mention the terms "testability" or "refactor + test". We identified ten composite refactoring procedures for the purpose of testability, which we call testability refactoring patterns. Third, we manually analyzed additional 524 test-pairs pull requests: both randomly selected and where we assumed to find testability refactorings, e.g. in pull requests about dependency or concurrency issues. About 25 refactoring patterns. The most frequent were extract a method for override or for invocation, widen access to a method for invocation, and extract a class for invocation. We also report on frequent atomic refactorings which co-occur with the patterns and discuss the implications of our findings for research, practice, and education

READ FULL TEXT

page 1

page 2

page 3

page 4

research
07/05/2018

An Insight into the Pull Requests of GitHub

Given the increasing number of unsuccessful pull requests in GitHub proj...
research
11/20/2018

Automatic Test Improvement with DSpot: a Study with Ten Mature Open-Source Projects

In the literature, there is a rather clear segregation between manually ...
research
04/25/2022

A very preliminary analysis of DALL-E 2

The DALL-E 2 system generates original synthetic images corresponding to...
research
08/10/2021

PyNose: A Test Smell Detector For Python

Similarly to production code, code smells also occur in test code, where...
research
12/02/2021

On the Documentation of Refactoring Types

Commit messages are the atomic level of software documentation. They pro...
research
10/26/2020

How We Refactor and How We Document it? On the Use of Supervised Machine Learning Algorithms to Classify Refactoring Documentation

Refactoring is the art of improving the design of a system without alter...
research
08/18/2023

Incrementalizing Production CodeQL Analyses

Instead of repeatedly re-analyzing from scratch, an incremental static a...

Please sign up or login with your details

Forgot password? Click here to reset