The Lost World: Characterizing and Detecting Undiscovered Test Smells

Author:

Yang Yanming1,Hu Xing2,Xia Xin3,Yang Xiaohu1

Affiliation:

1. Department of Computer Science and Technology, Zhejiang University, China

2. School of Software Technology, Zhejiang University, China

3. Software Engineering Application Technology Lab, Huawei, China

Abstract

Test smell refers to poor programming and design practices in testing and widely spreads throughout software projects. Considering test smells have negative impacts on the comprehension and maintenance of test code and even make code-under-test more defect-prone, it thus has great importance in mining, detecting, and refactoring them. Since Deursen et al. introduced the definition of “test smell”, only several studies worked on discovering new test smells from test specifications and software practitioners’ experience. Indeed, many bad testing practices are “observed” by software developers during creating test scripts rather than through academic research and are widely discussed in the software engineering community (e.g., Stack Overflow). However, no prior studies explored new bad testing practices from software practitioners’ discussions, formally defined them as new test smell types, and analyzed their characteristics, which plays a bad role for developers in knowing these bad practices and avoiding using them during test code development. Therefore, we pick up those challenges and act by working on systematic methods to explore new test smell types from one of the most mainstream developers’ Q&A platforms, i.e., Stack Overflow. We further investigate the harmfulness of new test smells and analyze possible solutions for eliminating them. We find that some test smells make developers hard to fix failed test cases and trace their failing reasons. Even worse, two of them risk the correctness of test cases. Next, we develop a detector to detect test smells from software. The detector is composed of six detection methods for different smell types. These detection methods are both wrapped with a set of syntactic rules based on the code patterns extracted from different test smells and developers’ code styles. We manually construct a test smell dataset from seven popular Java projects and evaluate the effectiveness of our detector on it. The experimental results show that our detector achieves high performance in precision, recall, and F1 score. Then, we utilize our detector to detect smells from 919 real-world Java projects to explore whether the six test smells are prevalent in practice. We observe that these test smells are widely spread in 722 out of 919 java projects, which demonstrates that they are prevalent in real-world projects. Finally, to validate the usefulness of test smells in practice, we submit 56 issue reports to 53 real-world projects with different smells. Our issue reports achieve 76.4% acceptance by conducting sentiment analysis on developers’ replies. These evaluations confirm the effectiveness of our detector and the prevalence and practicality of new test smell types on real-world projects.

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference110 articles.

1. [n. d.]. https://github.com/kestra-io/kestra/issues/1257. [n. d.]. https://github.com/kestra-io/kestra/issues/1257.

2. [n. d.]. https://github.com/spring-projects/spring-integr ation/commit/78fa2970fa9f7b64c6bf65db886f78b5dc1e4596. [n. d.]. https://github.com/spring-projects/spring-integr ation/commit/78fa2970fa9f7b64c6bf65db886f78b5dc1e4596.

3. [n. d.]. https://github.com/Yanming-Yang/TestSmellPackage. [n. d.]. https://github.com/Yanming-Yang/TestSmellPackage.

4. [n. d.]. https://stackoverflow.com/. [n. d.]. https://stackoverflow.com/.

5. [n. d.]. https://stackoverflow.com/questions/7075938/maki ng-a-private-method-public-to-unit-test-it-good-idea. [n. d.]. https://stackoverflow.com/questions/7075938/maki ng-a-private-method-public-to-unit-test-it-good-idea.

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3