PatBugs: A pattern-based bug detector for cross-platform mobile applications
Abstract
Mobile app developers suffer a lot from the fragmentation of mobile platforms (e.g., needs to rewrite an app for a new platform). To alleviate this problem, cross-platform development techniques provide a cost-effective way (i.e., write-once-deploymany) to develop mobile applications. Such cross-platform techniques usually provide a set of relevant APIs to operate a native component (e.g., the accelerometer sensor) of a mobile device, and developers usually need to use these APIs under some certain temporal constraints (e.g., developers need to explicitly call the method clearWatch after the method watchAcceleration to safely release an accelerometer sensor). Once such constraints are violated, temporal bugs would be introduced (e.g., resulting in energy problems). Compared with traditional native apps (e.g., developed based on Java for Android or Objective-C for iOS), cross-platform apps are mostly based on cross-platform but dynamic languages (e.g., JavaScript). The syntax flexibility and the event-based programming nature of such dynamic languages pose difficulties for the automatic detection of temporal bugs in cross-platform applications. In this paper, we propose an effective pattern-based detection approach for temporal bugs in cross-platform applications. In our approach, we propose a Flexible Bug Pattern Specification Notation (FBPSN), which supports flexible specification of a bug pattern involving a set of relevant APIs with temporal constraints. Based on specified bug patterns, our approach supports to systematically detect related temporal bugs in cross-platform applications. Through the evaluations, we show that our approach is both effective and efficient.