A Framework for Automated Test Mocking of Mobile Apps [conference paper]


Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering (ASE), NIER track - September 22, 2020


Mattia Fazzini (assistant professor), Alessandra Gorla, Alessandro Orso


Most software systems interact with their environment extensively. This is especially true for mobile apps, whose behavior often depends on sensors, external services, and inter-process communications. These interactions can complicate testing activities, as test cases may need a complete environment to be executed. They can also cause issues such as flakiness, for example when the environment behaves in non-deterministic ways. For these reasons, it is common to create test mocks that can eliminate the need for (part of) the environment to be present during testing. Manual mock creation, however, can be extremely time consuming and error-prone. Moreover, the generated mocks can typically only be used in the context of the specific tests for which they were created. To address these issues, we propose MOKA, a general framework for collecting and generating reusable test mocks in an automated way. MOKA leverages the ability to observe a large number of interactions between an application and its environment and uses an iterative approach to generate mocks with different reusability characteristics—advanced mocks generated through program synthesis and basic record-replay-based mocks. In this paper, we describe the new ideas behind MOKA, its main characteristics, a preliminary study, and a set of possible applications that would benefit from our framework.

Link to full paper

A Framework for Automated Test Mocking of Mobile Apps


software engineering, software testing, mobile applications