Hong Kong University of Science and Technology
Towards automated testing of WebViews in Android applications
Abstract
dc:description<p>WebView is a graphical user interface (GUI) widget that helps integrate web applications into the native context of Android apps. It provides powerful mechanisms to support bi-directional interactions between the native-end (Java) and the web-end (JavaScript) of an Android app. WebViews are widely adopted in real-world Android apps. Various studies have demonstrated that 83%-90% of the most-popular apps in the Google Play Store use WebViews in some fashion. Modern app-in-app ecosystems (e.g., WeChat Mini-Programs) are also built on top of WebViews.</p> <p>Despite its popularity among developers, WebView-induced bugs (ωBugs for short) are common in Android apps due to WebView’s complicated cross-language interaction mechanisms. However, little is known about the characteristics of these WebView-induced bugs. To bridge the gap, we conduct an empirical study on 124 ωBugs collected from 51 popular open-source Android apps. Our study characterizes ωBugs from a wide range of perspectives, including their root causes, consequences, and manifestation. We conclude interesting observations that can be leveraged for detecting and diagnosing ωBugs. Base on our empirical findings, we further propose an automated test generation technique, ωDroid, that is equipped with effective oracles to expose ωBugs in Android apps. An evaluation on 146 open-source Android apps demonstrated its effectiveness in detecting previously-unknown ωBugs that are of the developers’ concern.</p> <p>Although ωDroid can effectively manifest ωBugs, its test input generation procedure is based on a stress-testing tool Monkey, which generates a random sequence of user events (e.g., clicks, touches, or gestures) to exercise an app under test. Such a random test input generation approach is not effective in exploring diverse WebView behaviors in an app. In our second work, we study the problem of test input generation for WebViews in Android apps. Effective test input generation for WebViews requires identifying essential program properties to be covered by the generated tests. The coverage of these properties provides an effective measure of test adequacy for the WebView behaviors. Properties adopted by existing test generation techniques (e.g., program statements/branches) are not suitable for testing WebViews since none of them are specifically designed to model WebView behaviors. In this work, we propose WebView-specific properties to formally characterize WebView behaviors in an Android app. We also devise a cross-language dynamic analysis method to identify these properties. We further develop ωTest+, a fully-automated WebView-oriented test input generation technique that combines static and dynamic analysis. ωTest+ relies on a statically-built GUI component transition graph, in which GUI components that are helpful to reach WebViews are highlighted, as well as the coverage of WebView-specific properties to guide test input generation, in order to reach WebViews and exercise diverse WebView behaviors. We apply ωTest+ to test 38 real-world open-source Android apps. The results show that ωTest+ outperforms eight baseline methods in terms of the coverage of WebView-specific properties and the number of detected ωBugs.</p>
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Hu, Jiajun
- Contributors dc:contributor
-
- Cheung, Shing-chi
Rights
- Language dc:language
- English
Identifiers
dc:identifier.*- Repository record dc:identifier
- http://repository.hkust.edu.hk/ir/Record/1783.1-141090