An Empirical Study on the Usage of Mocking Frameworks in Software Testing

被引:35
|
作者
Mostafa, Shaikh [1 ]
Wang, Xiaoyin [1 ]
机构
[1] Univ Texas San Antonio, Dept Comp Sci, San Antonio, TX 78249 USA
关键词
D O I
10.1109/QSIC.2014.19
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
In software testing, especially unit testing, it is very common that software testers need to test a class or a component without integration with some of its dependencies. Typical reasons for excluding dependencies in testing include the unavailability of some dependency due to concurrent software development and callbacks in frameworks, high cost of invoking some dependencies (e.g., slow network or database operations, commercial third-party web services), and the potential interference of bugs in the dependencies. In practice, mock objects have been used in software testing to simulate such missing dependencies, and a number of popular mocking frameworks (e.g., Mockito, Easy-Mock) have been developed for software testers to generate mock objects more conveniently. However, despite the wide usage of mocking frameworks in software practice, there have been very few academic studies to observe and understand the usage status of mocking frameworks, and the major issues software testers are facing when using such mocking frameworks. In this paper, we report on an empirical study on the usage of four most popular mock frameworks (Mockito, EasyMock, JMock, and JMockit) in 5,000 open source software projects from GitHub. The results of our study show that the above mentioned mocking frameworks are used in a large portion (about 23%) of software projects that have test code. We also find that software testers typically create mocks for only part of the software dependencies, and there are more mocking of source code classes than library classes.
引用
收藏
页码:127 / 132
页数:6
相关论文
共 50 条
  • [1] An empirical study on the usage of mocking frameworks in Apache software foundation
    Xiao, Lu
    Zhao, Gengwu
    Wang, Xiao
    Li, Keye
    Lim, Erick
    Wei, Chenhao
    Yu, Tingting
    Wang, Xiaoyin
    [J]. EMPIRICAL SOFTWARE ENGINEERING, 2024, 29 (02)
  • [2] An empirical study on the usage of mocking frameworks in Apache software foundation
    Lu Xiao
    Gengwu Zhao
    Xiao Wang
    Keye Li
    Erick Lim
    Chenhao Wei
    Tingting Yu
    Xiaoyin Wang
    [J]. Empirical Software Engineering, 2024, 29
  • [3] To Mock or Not To Mock? An Empirical Study on Mocking Practices
    Spadini, Davide
    Aniche, Mauricio
    Bruntink, Magiel
    Bacchelli, Alberto
    [J]. 2017 IEEE/ACM 14TH INTERNATIONAL CONFERENCE ON MINING SOFTWARE REPOSITORIES (MSR 2017), 2017, : 402 - 412
  • [4] An Empirical Study of the Effects of Personality on Software Testing
    Kanij, Tanjila
    Merkel, Robert
    Grundy, John
    [J]. 2013 IEEE 26TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING EDUCATION AND TRAINING (CSEE&T), 2013, : 239 - 248
  • [5] Software Complexity and Testing Effectiveness: An Empirical Study
    Kevrekidis, Kostas
    Albers, Stijn
    Sonnemans, Peter J. M.
    Stollman, Guillaume M.
    [J]. ANNUAL RELIABILITY AND MAINTAINABILITY SYMPOSIUM, 2009 PROCEEDINGS, 2009, : 540 - +
  • [6] An Empirical Study on Software Testing Practices in Automotive
    Lami, Giuseppe
    Biscoglio, Isabella
    Falcini, Fabio
    [J]. SOFTWARE PROCESS IMPROVEMENT AND CAPABILITY DETERMINATION (SPICE 2016), 2016, 609 : 301 - 315
  • [7] An Empirical Study of Product Metrics in Software Testing
    Singh, Yogesh
    Kaur, Arvinder
    Suri, Bharti
    [J]. INNOVATIVE TECHNIQUES IN INSTRUCTION TECHNOLOGY, E-LEARNING, E-ASSESSMENT AND EDUCATION, 2008, : 64 - 72
  • [8] An Empirical Study of Test Cases in Software Testing
    Shete, Navnath
    Jadhav, Avinash
    [J]. 2014 INTERNATIONAL CONFERENCE ON INFORMATION COMMUNICATION AND EMBEDDED SYSTEMS (ICICES), 2014,
  • [9] Virtual reality software usage in an EFL scenario: An empirical study
    [J]. Chen, Y.-L. (ylchen@mail.lhu.edu.tw), 1600, Academy Publisher (09):
  • [10] The Correlation of Software Testing Efforts and Software Project Estimation: An Empirical Study
    Aziz, Junaid
    Ahmed, Faheem
    Campbell, Piers
    Jaffar, Ahmad
    [J]. NEW TRENDS IN SOFTWARE METHODOLOGIES, TOOLS AND TECHNIQUES, 2008, 182 : 39 - 50