arrow
返回

Excluding code from test coverage: practices, motivations, and impact

delete2022-12-07
delete5
PRE
AI
A
André Hora *
DOI:10.1007/s10664-022-10259-7delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Test coverage measures the percentage of code that is covered (and uncovered) by tests. In practice, not all code is equally important for coverage analysis, like code that will not be executed during tests. Some coverage tools provide support for code exclusion from coverage reports, however, we are not yet aware of what code tends to be excluded, the reasons behind it, and the impact on coverage analysis. In this paper, we provide an empirical study to understand code exclusion practices, motivations, and impact on test coverage. We first mine popular Python projects that adopt test coverage to assess code exclusion practices. We find that (1) over 1/3 of the projects perform coverage exclusion, (2) 75% of the code is already created using the exclusion feature, and (3) developers exclude non-runnable, debug-only, and defensive code, but also platform-specific and conditional importing. Next, we explore the motivations behind the exclusions and the importance of test coverage in current days: (4) most code is excluded because it is already untested, low-level, or complex and (5) distinct test coverage recommendations are available for developers, such as covering the change, exploring coverage reports, and increasing coverage. Lastly, we assess the impact of code exclusion on test coverage. We detect that (6) code exclusion may impact test coverage, decreasing the number of statements that should be covered by tests and (7) test coverage can be refined by following code exclusion recommendations. Based on our findings, we discuss implications for both practitioners and researchers to improve coverage analysis, tools, and documentation as well as inspire novel research on test coverage.
Keyword:
Software testing
Test coverage
Software evolution
Software maintenance
Software repository mining

期刊

Empirical Software Engineering 封面图
Empirical Software Engineering
IF:
3.6
论文数:
2.0K
被引数:
5.3K

机构

U
Universidade Federal de Minas Gerais
学者数:
2.5W
论文数: 1.5W
被引数: 1.4W
引用论文

引用论文

err分享
err收藏
Genetic Signatures From RNA Sequencing of Pediatric Localized Scleroderma Skin
err2021-06-07
err0
errOAAI
errEmily Mirizio; Christopher Liu; Qi Yan; Julia Waltermire; Roosha Mandel; Kaila L. Schollaert; Liza Konnikova; Xinjun Wang; Wei Chen; Kathryn S. Torok
err分享
err收藏
Code Coverage and Postrelease Defects: A Large-Scale Study on Open Source Projects
err2017-12-01
err27
errOAAI
errKochhar, Pavneet Singh; Lo, David; Lawall, Julia; Nagappan, Nachiappan
err分享
err收藏
Prevalence and Prognosis of Portopulmonary Hypertension in 223 Liver Transplant Recipients
err2018-09-18
err0
errOAAI
errJian Li; Qi Zhuang; Xueming Zhang; Ying Zheng; Zhiqing Qiao; Jianjun Zhang; Xuedong Shen; Jieyan Shen
err分享
err收藏
学者 查看更多内容