Abstract
dc:description.abstractTest smells are considered bad practices for developing the test code. Their presence can reduce the test code quality, thus harming software testing and maintenance activities. Software refactoring has been a key practice to handle smells and improve software quality without changing its behavior. However, existing refactoring tools target production code with very different characteristics than test code. Despite the research invested in test smell refactoring, little is known about whether current refactorings improve the test code quality. In this thesis, a machine learning-based approach is presented that can help developers decide when and how to refactor test smells. First, we aim to mine refactorings performed by developers to derive a catalog of test-specific refactorings and their impact on the test code. Our findings show that developers prefer specific features of the testing frameworks, which may lead to test smells such as Inappropriate Assertion and Exception Handling. While the refactorings proposed in the literature aligned with the evolution of testing frameworks to help refactor test smells, the Inappropriate Assertion remains unexplored in the literature. Second, we aim to understand whether developers target low-quality test codes to perform refactorings and the effects of refactorings on test code quality improvement. Our findings show that low-quality test code, especially regarding structural metrics, is more likely to undergo refactorings. Common refactorings between test and production code contribute more to improving test code quality in terms of cohesion, size, and complexity. Test-specific refactorings enhance quality concerning the resolution of test smells. Third, we aim to learn whether developers would perform refactorings and which refactorings they would apply to improve the test code quality. Results indicate that the accuracy of Support Vector Machines models varies between 30% and 100% in different projects for detecting when a developer would perform a refactoring. However, accuracy decreases for detecting specific refactorings due to the low data on test refactorings found in analyzed projects. Overall, this research demonstrates the feasibility of using structural metrics and test smells for detecting test refactorings. In addition, it highlights the need for improvements through the analysis of synthetic data and project development context. The proposed approach supports the detection and refactoring of test smells aligned with development practices currently adopted by developers.
Degree
thesis:*- Grantor dc:publisher
- Universidade Federal da Bahia
- Year dc:date.issued
- 2024
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Martins, Luana Almeida
Subjects
dc:subject × 4Rights
dc:rights- Statement dc:rights
-
- Acesso Aberto
- Language dc:language
- eng
Identifiers
dc:identifier.*- Repository record dc:identifier.uri
- https://repositorio.ufba.br/handle/ri/39886
- OAI identifier oai:identifier
- oai:repositorio.ufba.br:ri/39886