Refactoring Test Smells: A Perspective from Open-Source Developers

  • Elvys Soares UFPE
  • Márcio Ribeiro UFAL
  • Guilherme Amaral UFAL
  • Rohit Gheyi UFCG
  • Leo Fernandes IFAL
  • Alessandro Garcia PUC Rio
  • Baldoino Fonseca UFAL
  • André Santos UFPE

Resumo


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.

Publicado
19/10/2020
SOARES, Elvys; RIBEIRO, Márcio; AMARAL, Guilherme; GHEYI, Rohit; FERNANDES, Leo; GARCIA, Alessandro; FONSECA, Baldoino; SANTOS, André. Refactoring Test Smells: A Perspective from Open-Source Developers. In: SIMPÓSIO BRASILEIRO DE TESTES DE SOFTWARE SISTEMÁTICO E AUTOMATIZADO (SAST), 5. , 2020, Natal/RN. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2020 . p. 50–59.