Use of Test Doubles in Android Testing: An In-Depth Investigation
Mattia Fazzini, Chase Choi, Juan Manuel Copia, Gabriel Lee, Yoshiki Kakehi, Alessandra Gorla, Alessandro Orso
Abstract
Android apps interact with their environment extensively, which can result in flaky, slow, or hard-to-debug tests. Developers often address these problems using test doubles-developer-defined objects that replace app or library classes during test execution. Although test doubles are widely used, there is limited understanding of how they are used in practice. To bridge this gap, we present an in-depth empirical study that aims to shed light on how developers create and use test doubles in Android apps. In our study, we first analyze a dataset of 1,006 apps with publicly available test suites to identify which frameworks and approaches developers most commonly use to create test doubles. We then investigate several research questions by studying how test doubles defined using these popular frameworks are created and used in the ten apps in the dataset that define the highest number of test doubles using these frameworks. Our results, based on the analysis of 2,365 test doubles that replace a total of 784 classes, provide insight into the types of test doubles used within Android apps and how they are utilized. Our results also show that test doubles used in Android apps and traditional Java test doubles differ in at least some respect. Finally, our results show that test doubles can introduce test smells and even mistakes in the test code. In the paper, we also discuss some implications of our findings that can help researchers and practitioners working in this area and guide future research. CCS CONCEPTS • Software and its engineering → Software testing and debugging.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 4841d80f-df79-4ef1-9627-4e3f99b412cbCited by top-tier papers1
Ask how each one uses itBuilds on5
- Benchmarking automated GUI testing for Android against real-world bugsTing Su, Jue Wang, Zhendong SuFSE 2021 · 77 citations
- Test Automation in Open-Source Android Apps: A Large-Scale Empirical StudyJun-Wei Lin, Navid Salehnamadi, Sam MalekASE 2020 · 27 citations
- Identifying Java calls in native code via binary scanningGeorge Fourtounis, Leonidas Triantafyllou, Yannis SmaragdakisISSTA 2020 · 23 citations
- MockSniffer: Characterizing and Recommending Mocking Decisions for Unit TestsHengcheng Zhu, Lili Wei, Ming Wen, Yepang Liu et al.ASE 2020 · 17 citations
- An automatic refactoring framework for replacing test-production inheritance by mocking mechanismXiao Wang, Lu Xiao, Tingting Yu, Anne Woepse et al.FSE 2021 · 15 citations
Related papers
- Automated Third-Party Library Detection for Android Applications: Are We There Yet?Xian Zhan, Lingling Fan, Tianming Liu, Sen Chen et al.ASE 2020 · 55 citations
- A Longitudinal Analysis Of Replicas in the Wild Wild AndroidSyeda Mashal Abbas Zaidi, Shahpar Khan, Parjanya Vyas, Yousra AaferASE 2024
- An Empirical Study on the Robustness of Android Third-Party Library Detection Tools Against Advanced ObfuscationDahan Pan, Zhuohao Zhang, Yunjia Min, Runhan Feng et al.ICSE 2026
- Reproducing Timing-Dependent GUI Flaky Tests in Android Apps via a Single Event DelayXiaobao Cai, Zhen Dong, Yongjiang Wang, Abhishek Tiwari et al.ISSTA 2024 · 1 citation
- Demystifying Android Non-SDK APls: Measurement and UnderstandingShishuai Yang, Rui Li, Jiongyi Chen, Wenrui Diao et al.ICSE 2022 · 14 citations
