NATE: A Network-Aware Testing Enhancer for Network-Related Fault Detection in Android Apps
Nowadays, Android apps are becoming much more network-dependent, with increasingly network-related faults being observed, severely undermining user experience. Given such faults scattered in modern apps and requiring complex network patterns to trigger, their detection is challenging. To date, we still lack a general and in-depth understanding of such faults. To fill this gap, we conduct the \textit{first} systematic study on 154 real-world network-related bugs filtered from 42 diverse representative Android apps to investigate their characteristics, influences, triggering patterns, and origins. Notable findings and implications have been revealed that shed light on further research on tackling such faults. While existing Android testing approaches struggle with detecting such faults due to a lack of effective network events and efficient injection, we propose NATE on the basis of our study, a network-aware testing enhancer to empower existing general Android testing approaches to detect network-related faults. Based on curiosity-driven reinforcement learning, NATE conducts network-aware guidance to inject effective network events, enabling testing approaches to explore network-related extra app functionalities and detect network-related faults. Based upon two state-of-the-art general Android testing approaches, experiments conducted on 12 large, active apps demonstrate the effectiveness and efficiency of NATE, with 1.7-5.7 times faults detected, 8.8% and 12.5% more code covered. Among the network-related faults detected by NATE, 20 have been explicitly confirmed as real-world bugs, with 6 of them already resolved. Notably, 15 of them were found by NATE for the first time, while none were detected by the original general testing approaches.