Mutation Testing in Test Code Refactoring: Leveraging Mutants to Ensure Behavioral Consistency
摘要
Previous research has identified mutation testing as a promising technique for detecting unintended changes in test behavior during test code refactorings. Despite its theoretical support, the practical adoption of this approach has been hindered by a lack of corresponding tools. Consequently, these studies have been unable to fully validate the effectiveness of mutation testing as a guardrail to ensure the consistency of the refactored test behavior, leaving an in-depth empirical validation open for future research. To address this gap, this study examines MeteoR, a tool developed as a reference implementation to support test refactoring by using mutation testing. We leverage MeteoR to validate the practical applicability of the mutation testing approach across diverse test refactoring scenarios. This evaluation uses a catalog of common test refactorings that reflect real-world practices. The results indicate that MeteoR effectively detects changes in test behavior in most cases, demonstrating the efficacy of mutation testing to identify problems during test code refactoring. However, the study also identifies limitations, particularly the occurrence of false negatives when refactorings modify the way tests handle dependencies. These findings highlight the potential of the approach and contribute to the state-of-the-art by identifying limitations that can be addressed in future studies.