Detection of Android application flaky test based on read-write race
Software testing is a crucial method for ensuring the quality of Android applications. Typically, the failure of test case execution suggests the presence of an error within the application. However, within Android multi-threaded environment, factors such as changes in the execution order of threads can produce inconsistent outcomes for specific operations across multiple test executions, thereby leading to inconsistent test results. In such instances, developers are unable to determine whether errors exist in the program based solely on test results, significantly impacting the reliability of software testing. This phenomenon is referred to as "flaky test." During the development of Android applications, the absence of an appropriate synchronization mechanism to regulate the order of variable access among threads can easily trigger Read- Write races, contributing to flaky tests. In response, this paper introduces a method for detecting flaky tests in concurrency-related Android applications. This method involves capturing the event execution trajectory during test execution and identifying Read-Write races among events along the trajectory. It introduces two key metrics, Event Significance and Inter-Event Influence, to construct an Event Conflict Network. Utilizing this network, the method calculates the priority of the Event Conflict Network and employs priority-based Event Scheduling to identify flaky tests by inducing Read-Write races within as few test executions as possible. The effectiveness of this methodology was assessed using 22 test cases from Android applications. Experimental results demonstrate that our method successfully detected all 22 flaky tests in the dataset, achieving a 33.7% reduction in average detection time compared to existing state-of-the-art methods.
Authors
- Ruilian Zhao
- Dong Hua (ORCID: https://orcid.org/0000-0001-8197-5851)
- Weixi Zhang
- Wentian Zhang
Institutions
- Beijing University of Chemical Technology (CN)
Publication Details
- Published
- 2024-10-16
- DOI
- https://doi.org/10.1117/12.3034142
- Primary Topic
- Advanced Malware Detection Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00