ICSE 2020
Mon 6 July - Sun 11 October 2020

Existing GUI testing approaches of Android apps usually test apps from a single entry, in this way, the marginal activities far away from the default entry are difficult to be covered. The marginal activities may fail to be launched due to requiring a great number of activity transitions or involving complex user operations, leading to uneven coverage on activity components. Besides, since the test space of GUI programs is infinite, it is difficult to test activities under complete launching contexts using single-entry testing approaches.

In this paper, we address these issues by constructing activity launching contexts and proposing a multiple-entry testing framework. We perform an inter-procedural, flow-, context- and path-sensitive analysis to build activity launching models and generate complete launching contexts. By exposing activities, we could launch them directly under various contexts without performing long event sequence on GUI. Besides, to achieve an in-depth exploration and detect more bugs, we design an adaptive exploration framework which supports the multiple-entry exploration and dynamically assigns a weight to each entry.

Our approach is implemented in a tool called \textit{Fax}, with an activity launching strategy Fax${la}$ and an exploration strategy Fax${ex}$. The experiments on 20 real-world apps show that Fax${la}$ can successfully launch 68.5% activities, based on which Fax${ex}$ further achieves a relatively 18.0% improvement on method coverage compared with the most popular tool Monkey. Our tool also behaves well in revealing hidden bugs. The number of unique crashes detected by Fax, which is over four hundred, is significantly higher than those of other tools. Among the 45 crashes reported to developers on Github, 24 have been fixed and 4 have been confirmed.