Refactorings are transformations to improve the code design without changing overall functionality and observable behavior. During the refactoring process of smelly test code, practitioners may struggle to identify refactoring candidates and define and apply corrective strategies. This paper reports on an empirical study aimed at understanding how test smells and test refactorings are discussed on the Stack Exchange network. Developers commonly count on Stack Exchange to pick the brains of the wise, i.e., to `look up' how others are completing similar tasks. Therefore, in light of data from the Stack Exchange discussion topics, we could examine how developers understand and perceive test smells, the corrective actions they take to handle them, and the challenges they face when refactoring test code aiming to fix test smells. We observed that developers are interested in others' perceptions and hands-on experience handling test code issues. Besides, there is a clear indication that developers often ask whether test smells or anti-patterns are either good or bad testing practices than code-based refactoring recommendations.
翻译:重构是在不改变整体功能和可观察行为的前提下改善代码设计的转换过程。在重构有坏味的测试代码时,开发者可能难以识别重构候选对象,并定义与应用修正策略。本文报告了一项实证研究,旨在理解测试坏味与测试重构如何在Stack Exchange网络上被讨论。开发者通常依赖Stack Exchange来汲取智慧,即“查阅”他人如何完成类似任务。因此,基于Stack Exchange讨论主题的数据,我们可以考察开发者如何理解与感知测试坏味、他们处理这些问题所采取的修正措施,以及在修复测试坏味过程中重构测试代码时面临的挑战。我们观察到,开发者对他人处理测试代码问题的观点与实践经验感兴趣。此外,有明显的迹象表明,开发者更常询问测试坏味或反模式是好的还是坏的测试实践,而非基于代码的重构建议。