Skip to content

Opening book details…

Can I read To Mock or Not to Mock? An Empirical Study on Mocking Practices on EtoBox?

To Mock or Not to Mock? An Empirical Study on Mocking Practices by Davide Spadini; Mauricio Aniche; Magiel Bruntink; Alberto Bacchelli is a scholarly article available to read on EtoBox.

What is To Mock or Not to Mock? An Empirical Study on Mocking Practices about?

When writing automated unit tests, developers often deal with software artifacts that have several dependencies. In these cases, one has the possibility of either instantiating the dependencies or using mock objects to simulate the dependencies' expected behavior. Even though recent quantitative studies showed that mock objects are widely used in OSS projects, scientific knowledge is still lacking on how and why practitioners use mocks. Such a knowledge is fundamental to guide further research on this widespread practice and inform the design of tools and processes to improve it. The objective of this paper is to increase our understanding of which test dependencies developers (do not) mock and why, as well as what challenges developers face with this practice. To this aim, we create MOCKEXTRACTOR, a tool to mine the usage of mock objects in testing code and employ it to collect data from three OSS projects and one industrial system. Sampling from this data, we manually analyze how more than 2,000 test dependencies are treated. Subsequently, we discuss our findings with developers from these systems, identifying practices, rationales, and challenges. These results are supported by

Author
Davide Spadini; Mauricio Aniche; Magiel Bruntink; Alberto Bacchelli
Publisher
IEEE
Published
2017
Language
EN

More by Davide Spadini; Mauricio Aniche; Magiel Bruntink; Alberto Bacchelli

Browse all works by Davide Spadini; Mauricio Aniche; Magiel Bruntink; Alberto Bacchelli