
Why Mobile Test Automation Is Still Flaky (and What Actually Fixes It)
Shachar Landshut
Co-founder @ Loadmill | Building agent-based testing (CUA) |
Mobile test automation has come a long way.
Frameworks are more mature. Tooling is more accessible. CI pipelines are faster and more reliable.
And yet, one problem continues to show up across teams:
Flaky tests are still everywhere.
Tests pass locally but fail in CI.
They break after small UI changes.
They fail intermittently without a clear cause.
Over time, engineers stop trusting them. Coverage becomes misleading. Debugging takes longer than writing tests.
The Problem Isn’t Just the Tool
When teams investigate flaky tests, the focus usually goes to:
- device instability
- network issues
- CI environments
- test data
These can contribute to failures, but they are rarely the root cause.
The deeper issue is structural.
Most mobile test automation is built on assumptions that don’t hold in real-world apps.
The Assumptions That Break
Traditional mobile automation assumes:
- a stable UI structure
- consistent element identifiers
- predictable timing
- linear user flows
In practice, mobile apps behave very differently.
They include:
- dynamic layouts that change across sessions
- popups, banners, and interruptions
- conditional flows based on user state
- asynchronous loading
- personalization and experimentation
This creates a mismatch.
Tests are written for deterministic systems.
Apps behave as dynamic systems.
Why Locators Become a Liability
Selectors are a core part of traditional automation.
They allow tests to interact with specific elements by ID, XPath, or accessibility labels.
But they also create tight coupling between tests and implementation details.
A simple step like:
Tap element with ID “checkout_button”
assumes:
- the ID exists
- the element is visible
- the UI structure hasn’t changed
- nothing blocks interaction
If any of these assumptions break, the test fails.
Even if the actual user flow still works.
Timing Is Not the Root Cause
A common response to flakiness is to adjust timing:
- increase timeouts
- add waits
- retry failed tests
These changes may reduce noise, but they do not solve the underlying problem.
They treat symptoms, not causes.
Flakiness Comes From a Model Mismatch
At its core, flakiness is not random.
It is the result of a mismatch:
- tests assume stability
- apps behave dynamically
As long as this gap exists, test reliability will remain limited.
What Actually Improves Reliability
Improving reliability requires changing how tests are designed.
Not just how they are executed.
1. Move From Structure to Behavior
Instead of targeting specific elements, focus on visible behavior.
For example:
Instead of:
Tap element with ID “checkout_button”
Use:
Tap “Checkout” and verify the payment screen is visible
This shifts the focus from implementation details to user experience.
2. Make Success Explicit and Observable
Many tests fail because success is loosely defined.
A statement like:
Verify checkout worked
is not actionable.
A stronger assertion is:
Verify the “Order confirmed” screen is visible
Tests need clear, visible outcomes.
3. Handle the UI as It Actually Behaves
Real mobile apps include:
- popups
- loading states
- unexpected interruptions
Reliable tests must account for this.
For example:
Close any popup if it appears
This aligns test behavior with real user interaction.
4. Reduce Dependence on Exact Paths
Rigid step-by-step flows break easily when the UI changes.
A more resilient approach is to:
- define goals
- allow flexibility in execution
This reduces the impact of minor UI changes.
Where AI Testing Agents Change the Model
AI testing agents introduce a different execution model.
Instead of relying on selectors and fixed flows, they:
- observe the screen
- interpret instructions
- decide what action to take
- adapt to what appears
This reduces dependence on:
- fragile locators
- rigid scripts
- exact UI structure
Connecting the Dots
This is part of a broader shift in test automation:
- selectors → visual understanding
- scripts → intent-driven instructions
- fixed flows → adaptive execution
If you want a deeper look at how this works in practice:
The Bottom Line
Flaky mobile tests are not just a tooling issue.
They are a design issue.
As long as tests assume stability in a dynamic system, they will remain brittle.
Improving reliability requires aligning how tests work with how applications actually behave.
Try Loadmill Droid CUA
Loadmill Droid CUA enables teams to execute mobile tests using AI-driven agents that interpret instructions, adapt to UI changes, and validate real user flows.
If test reliability is limiting your coverage, it’s worth exploring a different execution model.