More about HKUST
Towards Automated Testing of WebViews in Android Applications
PhD Thesis Proposal Defence Title: "Towards Automated Testing of WebViews in Android Applications" by Mr. Jiajun HU Abstract: WebView is a graphical user interface (GUI) widget that enables native Android apps to integrate web applications. WebViews can not only render HTML pages and execute JavaScript code, but also provide powerful mechanisms that facilitate the 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. Despite its popularity among developers, the complicated cross-language mechanisms have induced various types of bugs into Android apps. However, little is known about the characteristics of these WebView-induced bugs (wBugs for short). To bridge the gap, we conduct an empirical study on 124 wBugs collected from 51 popular open-source Android apps. Our study characterize wBugs 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 wBugs. Base on our empirical findings, we further propose an automated test generation technique, wDroid, that uses specially designed oracles to effectively expose wBugs in Android apps. An evaluation on 146 open-source Android apps have demonstrated its effectiveness in detecting previously-unknown wBugs that are of the developers' concern. Although wDroid can effectively manifest wBugs, its test generation producer 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 random test generation approach is not effective in exploring diverse WebView behaviors in an app. In our second work, we study the problem of test generation for WebViews in Android apps. Effective test 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 design a search-based test generation technique, wTest, that searches for event sequences to cover the identified properties. We evaluate wTest on 74 open-/closed-source Android apps in terms of property coverage and the number of detected wBugs. Compared against baseline methods, wTest is effective in exploring diverse WebView behaviors and detect the most number of wBugs. Date: Thursday, 31 August 2023 Time: 10:00am - 12:00noon Venue: Room 5501 lifts 25/26 Committee Members: Prof. Shing-Chi Cheung (Supervisor) Dr. Amir Goharshady (Chairperson) Dr. Jiasi Shen Dr. Shuai Wang **** ALL are Welcome ****