Refactoring Test Smells
Authors:
Open Access
- 20 October 2020
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 50-59
Abstract
Test smells are symptoms in the test code that indicate possible design or implementation problems. Their presence, along with their harmfulness, has already been demonstrated by previous researches. However, we do not know to what extent developers acknowledge the presence of test smells and how to refactor existing code to eliminate them in practice. This study aims to assess open-source developers' awareness about the existence of test smells and their refactoring strategies. We conducted a mixed-method study with two parts: (i) a survey with 73 experienced open-source developers to assess their preference and motivation to choose between 10 different smelly test code samples, found in 272 open-source projects, and their refactored versions; and (ii) the submission of 50 pull requests to assess developers' acceptance of the proposed refactorings. As a result, most surveyed developers preferred the refactored proposal for 78% of the investigated test smells, and the pull requests had an average acceptance of 75% among respondents. Additionally, we were able to provide empiric validation for literature-proposed refactoring strategies. This study demonstrates that although not always using the academic terminology, developers acknowledge both the negative impact of test smells presence and most of the literature's proposals for their removal.Keywords
Funding Information
- Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (117875)
- Fundação de Amparo à Pesquisa do Estado de Alagoas (60030.0000000462/2020)
- Conselho Nacional de Desenvolvimento Científico e Tecnológico (309844/2018-5)
This publication has 7 references indexed in Scilit:
- RETRACTED ARTICLE: The smell of fear: on the relation between test smells and flaky testsEmpirical Software Engineering, 2019
- Smells in software test code: A survey of knowledge in industry and academiaJournal of Systems and Software, 2018
- An empirical investigation into the nature of test smells2016
- On the diffusion of test smells in automatically generated test code2016
- Are test smells really harmful? An empirical studyEmpirical Software Engineering, 2014
- How We Refactor, and How We Know ItIEEE Transactions on Software Engineering, 2011
- On The Detection of Test Smells: A Metrics-Based Approach for General Fixture and Eager TestIEEE Transactions on Software Engineering, 2007