题名 | MockSniffer: Characterizing and Recommending Mocking Decisions for Unit Tests |
作者 | |
通讯作者 | Liu,Yepang |
DOI | |
发表日期 | 2020-09-01
|
ISSN | 1938-4300
|
ISBN | 978-1-7281-7281-1
|
会议录名称 | |
页码 | 436-447
|
会议日期 | 21-25 Sept. 2020
|
会议地点 | Melbourne, VIC, Australia
|
摘要 | In unit testing, mocking is popularly used to ease test effort, reduce test flakiness, and increase test coverage by replacing the actual dependencies with simple implementations. However, there are no clear criteria to determine which dependencies in a unit test should be mocked. Inappropriate mocking can have undesirable consequences: under-mocking could result in the inability to isolate the class under test (CUT) from its dependencies while over-mocking increases the developers' burden on maintaining the mocked objects and may lead to spurious test failures. According to existing work, various factors can determine whether a dependency should be mocked. As a result, mocking decisions are often difficult to make in practice. Studies on the evolution of mocked objects also showed that developers tend to change their mocking decisions: 17% of the studied mocked objects were introduced sometime after the test scripts were created and another 13% of the originally mocked objects eventually became unmocked. In this work, we are motivated to develop an automated technique to make mocking recommendations to facilitate unit testing. We studied 10, 846 test scripts in four actively maintained open-source projects that use mocked objects, aiming to characterize the dependencies thatare mocked in unit testing. Based on our observations on mocking practices, we designed and implemented a tool, MockSniffer, to identify and recommend mocks for unit tests. The tool is fully automated and requires only the CUT and its dependencies as input. It leverages machine learning techniques to make mocking recommendations by holistically considering multiple factors that can affect developers' mocking decisions. Our evaluation of Mock-Sniffer on ten open-source projects showed that it outperformed three baseline approaches, and achieved good performance in two potential application scenarios. |
关键词 | |
学校署名 | 第一
; 通讯
|
语种 | 英语
|
相关链接 | [Scopus记录] |
收录类别 | |
WOS记录号 | WOS:000651313500038
|
EI入藏号 | 20210309773286
|
EI主题词 | Automation
; Learning systems
; Open source software
|
EI分类号 | Computer Software, Data Handling and Applications:723
; Automatic Control Principles and Applications:731
|
Scopus记录号 | 2-s2.0-85099230324
|
来源库 | Scopus
|
全文链接 | https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9286134 |
引用统计 |
被引频次[WOS]:12
|
成果类型 | 会议论文 |
条目标识符 | http://sustech.caswiz.com/handle/2SGJ60CL/221932 |
专题 | 南方科技大学 工学院_计算机科学与工程系 |
作者单位 | 1.Southern University of Science and Technology,Shenzhen,China 2.Hong Kong University of Science and Technology,Hong Kong,Hong Kong 3.Huazhong University of Science and Technology,Wuhan,China 4.WeBank Co Ltd,Shenzhen,China |
第一作者单位 | 南方科技大学 |
通讯作者单位 | 南方科技大学 |
第一作者的第一单位 | 南方科技大学 |
推荐引用方式 GB/T 7714 |
Zhu,Hengcheng,Wei,Lili,Wen,Ming,et al. MockSniffer: Characterizing and Recommending Mocking Decisions for Unit Tests[C],2020:436-447.
|
条目包含的文件 | 条目无相关文件。 |
|
除非特别说明,本系统中所有内容都受版权保护,并保留所有权利。
修改评论