[Paper Review] Concurrency-related Flaky Test Detection in Android apps
This paper presents FlakeScanner, a tool that proactively detects concurrency-related flaky tests in Android apps by systematically exploring feasible event execution orders across UI and background threads. By analyzing event scheduling bounds and grouping events per statement, FlakeScanner identifies flaky tests—even among passing ones—demonstrating high efficacy on the FlakyAppRepo suite, which uncovered 245 new flaky tests beyond known cases.
Validation of Android apps via testing is difficult owing to the presence of flaky tests. Due to non-deterministic execution environments, a sequence of events (a test) may lead to success or failure in unpredictable ways. In this work, we present an approach and tool FlakeShovel for detecting flaky tests through systematic exploration of event orders. Our key observation is that for a test in a mobile app, there is a testing framework thread which creates the test events, a main User-Interface (UI) thread processing these events, and there may be several other background threads running asynchronously. For any event e whose execution involves potential non-determinism, we localize the earliest (latest) event after (before) which e must happen.We then efficiently explore the schedules between the upper/lower bound events while grouping events within a single statement, to find whether the test outcome is flaky. We also create a suite of subject programs called DroidFlaker to study flaky tests in Android apps. Our experiments on subject-suite DroidFlaker demonstrate the efficacy of our flaky test detection. Our work is complementary to existing flaky test detection tools like Deflaker which check only failing tests. FlakeShovel can detect flaky tests among passing tests, as shown by our approach and experiments.
Motivation & Objective
- To address the critical problem of flaky tests in Android GUI testing, which undermine regression testing reliability and developer productivity.
- To detect flaky tests proactively, including those that pass in standard runs but fail under certain non-deterministic execution orders.
- To overcome the limitations of existing tools like DeFlaker, which only analyze failing tests and miss flaky tests that pass.
- To create a comprehensive benchmark suite, FlakyAppRepo, to study flaky test behavior in real-world Android applications.
- To provide a dynamic, system-level analysis that captures precise event dependencies and avoids false positives from incomplete happens-before relations.
Proposed method
- FlakeScanner models Android's single UI thread and asynchronous background threads, identifying event scheduling bounds for each test event.
- For each event with potential non-determinism, it computes the earliest and latest events before and after which it must execute, based on thread dependencies.
- It then performs a systematic exploration of event orderings within these bounds, grouping events from the same statement to reduce state space.
- The tool uses dynamic analysis to simulate different execution environments and detect whether any event order leads to test failure.
- It leverages the Espresso testing framework’s event queue semantics to model realistic thread interleavings and event races.
- The approach is complemented by the creation of FlakyAppRepo, a curated suite of 28 popular Android apps with 2.5k GitHub stars on average, used to evaluate flaky test detection.
Experimental results
Research questions
- RQ1Can a proactive detection approach identify concurrency-related flaky tests that pass in standard runs but fail under certain execution orders?
- RQ2How effective is systematic exploration of event orderings in detecting flaky tests compared to existing rerun-based or coverage-based methods?
- RQ3What is the prevalence of flaky tests in real-world Android applications, particularly those that pass but are still flaky?
- RQ4To what extent can precise event dependency modeling reduce false positives in flaky test detection?
- RQ5How does the proposed method compare in accuracy and scalability to existing tools like DeFlaker and event race detectors?
Key findings
- FlakeScanner successfully detected 245 new flaky tests in the FlakyAppRepo suite that were not previously identified, demonstrating its ability to uncover hidden flakiness.
- The tool detected flaky tests among those that passed in standard runs, proving its proactive detection capability beyond existing tools that only analyze failing tests.
- The FlakyAppRepo benchmark suite, containing 28 widely-used Android apps with an average of 2.5k GitHub stars, provides a realistic and representative testbed for studying flaky tests.
- The study confirms that concurrency and asynchronous waiting are the primary causes of flaky tests, aligning with prior empirical findings.
- FlakeScanner’s dynamic analysis with precise event dependency modeling reduced false positives compared to approaches relying on incomplete happens-before relations.
- The results show that flaky tests are a pervasive issue—84% of pass-to-fail transitions in regression testing are due to flaky tests, highlighting the need for proactive detection.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.