添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • Coordenao de Ps-graduao, Universidade Federal de Pernambuco Centro de Informatica, 312531 Recife, Pernambuco, Brazil, 50740-560
  • Computing Institute, Federal University of Alagoas, Macei, Alagoas, Brazil, 57072-900
  • Department of Computing and Systems, Federal University of Campina Grande, Brazil, Paraba, Brazil
  • Computing Institute, Federal University of Alagoas, Macei, Alagoas, Brazil
  • Coordenao de Ps-graduao, Universidade Federal de Pernambuco Centro de Informatica, 312531 Recife, Pernambuco, Brazil
  • Test smells are symptoms in the test code that indicate possible design or implementation problems. Previous research demonstrated their harmfulness and the developers’ acknowledgment of test smells’ effects, prevention, and refactoring strategies. Test automation frameworks are constantly evolving, and the JUnit, one of the most used ones for Java projects, has its version 5 available since late 2017. However, we do not know the extent to which developers use the newly introduced features and whether such features indeed help refactor existing test code to remove test smells. This article conducts a mixed-method study investigation to minimize these knowledge gaps. Our study consists of three parts. First, we evaluate the usage of this framework and its features by analyzing the source code of 485 popular Java open-source projects on GitHub that use JUnit. We found that 15.9% of these projects use the JUnit 5 library. We also found that, from 17 new features detected in use, only 3 (i.e., 17.6%) are responsible for more than 70% of usages, limiting optimized propositions to test code creation and maintenance. Second, after identifying features in the JUnit 5 framework that could be considered to test smells removal and prevention, we use these features to propose novel refactorings. In particular, we present refactorings based on 7 introduced JUnit 5 features that help to remove 13 test smells, such as Assertion Roulette, Test Code Duplication, and Conditional Test Logic. Third, to evaluate our refactorings with the opinions of experienced developers, we (i) survey 212 developers for their preferences and comments about our refactorings, corroborating the benefits of our proposals and raising community feedback on JUnit 5 features, and (ii) we refactor actual test code from popular GitHub Java projects and submit 38 Pull Requests, reaching a 94% acceptance rate among respondents. As implications of our study, we alert the software testing community (i.e., practitioners and researchers) to the need to study the JUnit 5 features to effectively remove and prevent test smells. To better assist this process, we give directions on how test smells can be refactored using such features. 中文翻译: 测试气味是测试代码中的症状,表明可能存在设计或实现问题。先前的研究证明了它们的危害性以及开发人员对测试气味的影响、预防和重构策略的认可。测试自动化框架在不断发展,JUnit 作为 Java 项目中最常用的框架之一,自 2017 年底以来推出了第 5 版。但是,我们不知道开发人员在多大程度上使用了新引入的功能以及这些功能是否确实有助于重构现有的测试代码以消除测试气味。本文进行了一项混合方法研究调查,以尽量减少这些知识差距。我们的研究包括三个部分。第一的,我们通过分析 GitHub 上 485 个使用 JUnit 的流行 Java 开源项目的源代码来评估这个框架的使用及其特性。我们发现这些项目中有 15.9% 使用了 JUnit 5 库。我们还发现,在使用中检测到的 17 个新功能中,只有 3 个(即 17.6%)负责超过 70% 的使用,将优化建议限制为测试代码创建和维护。其次,在确定 JUnit 5 框架中可考虑用于测试气味去除和预防的功能后,我们使用这些功能提出新颖的重构。特别是,我们提出了基于 7 个引入的 JUnit 5 功能的重构,这些功能有助于消除 13 种测试异味,例如断言轮盘赌、测试代码重复和条件测试逻辑。第三,为了根据经验丰富的开发人员的意见评估我们的重构,我们 (i) 调查了 212 名开发人员对我们重构的偏好和评论,证实了我们提议的好处并提高了社区对 JUnit 5 功能的反馈,以及 (ii) 我们重构了实际测试从流行的 GitHub Java 项目中获取代码并提交 38 个 Pull Request,受访者接受率达到 94%。作为我们研究的意义,我们提醒软件测试社区(即从业者和研究人员)需要研究 JUnit 5 功能以有效消除和防止测试气味。为了更好地协助这个过程,我们给出了如何使用这些功能重构测试气味的指导。证实我们提案的好处并提高社区对 JUnit 5 功能的反馈,以及 (ii) 我们重构了来自流行的 GitHub Java 项目的实际测试代码并提交了 38 个 Pull Requests,在受访者中达到了 94% 的接受率。作为我们研究的意义,我们提醒软件测试社区(即从业者和研究人员)需要研究 JUnit 5 功能以有效消除和防止测试气味。为了更好地协助这个过程,我们给出了如何使用这些功能重构测试气味的指导。证实我们提案的好处并提高社区对 JUnit 5 功能的反馈,以及 (ii) 我们重构了来自流行的 GitHub Java 项目的实际测试代码并提交了 38 个 Pull Requests,在受访者中达到了 94% 的接受率。作为我们研究的意义,我们提醒软件测试社区(即从业者和研究人员)需要研究 JUnit 5 功能以有效消除和防止测试气味。为了更好地协助这个过程,我们给出了如何使用这些功能重构测试气味的指导。从业者和研究人员)到需要研究 JUnit 5 的特性,以有效去除和防止测试气味。为了更好地协助这个过程,我们给出了如何使用这些功能重构测试气味的指导。从业者和研究人员)到需要研究 JUnit 5 的特性,以有效去除和防止测试气味。为了更好地协助这个过程,我们给出了如何使用这些功能重构测试气味的指导。