In recent years, there has been a significant surge in the use and development of apps for smartphones and tablets. The complexity of mobile apps mostly lies in their graphical user interfaces (GUIs) since the computational part of these apps are either simple or is delegated to a backend server. Therefore, testing efforts of these apps mostly focus on the behavior of graphical user interfaces.
In this thesis, we address two problems in GUI testing, test suite generation and test suite reduction, in the context of Android apps. In the first part of the thesis, we propose the SwiftHand algorithm for automatically generating sequences of test inputs for GUI apps. The algorithm uses machine learning to learn a model of the app during testing, uses the learned model to generate user inputs that visit unexplored states of the app, and uses the execution of the app on the generated inputs to refine the model. A key feature of the algorithm is that it avoids restarting the app, which is a significantly more expensive operation than executing the app on a sequence of inputs. We evaluate SwiftHand on several Android apps, showing that it can outperform a simple fuzz-testing algorithm and a traditional active-learning based testing algorithm.
In the second part of the thesis, we address the problem of reducing GUI test suites generated by automated testing tools. Automated testing tools, including SwiftHand, have been shown to be effective in achieving good test coverage and in finding bugs. Being automated, these tools typically run for a long period, e.g. for several hours, until the time budget for testing expires. However, these tools are not good at generating concise regression test suites that could be used for testing in incremental development of the apps and in regression testing. We propose DetReduce, a heuristic technique that helps to create a small regression test suite for a GUI app given a large test suite generated by running an automated GUI testing tool. The key insight is that if we can identify and remove some common forms of redundancies introduced by existing automated GUI testing tools, then we can drastically lower the time required to minimize a GUI test suite. We evaluate DetReduce on several Android apps, showing that it can reduce the size and running time of an automatically generated test suite by at least an order of magnitude.