Stop Maestro builds automatically with fail fast
Automatically stop a Maestro build on App Automate after a specified number of flows fail to save device time and get results faster.
Continuing a test run after a known failure wastes limited device farm capacity. Fail fast aborts the build as soon as a specified failure threshold is reached, returning results faster and freeing up hardware for other queued jobs. It works for Maestro builds on both Android and iOS.
Enable fail fast
To enable fail fast, add testOrchestrationOptions.abortBuildOnFailure to your builds REST API request. Set enabled to true and maxFailures to the number of failed flows that stops the build.
Use the following cURL request for your platform:
Replace YOUR_USERNAME and YOUR_ACCESS_KEY with your BrowserStack credentials, and the bs:// IDs with the app and test suite IDs returned when you uploaded them.
Keep the following in mind:
-
maxFailuresaccepts an integer from1to1000. - Setting
enabledtotruewithoutmaxFailuresfails validation.
Build each flow so it doesn’t depend on app or device state left over from a prior flow. Self-contained flows make fail fast results easier to interpret and let you rerun a single flow on its own without first replaying the ones before it.
How failures are counted
Fail fast counts a flow as failed only after all its retries are exhausted.
When automatic reruns are active, the effect depends on the platform:
- iOS: Maestro reruns each failed flow immediately, so a failure becomes final while the build is still running. Fail fast stops the remaining flows as soon as the threshold is reached.
- Android: reruns happen in a separate pass after every flow has run once. By the time a failure becomes final, all flows have already run, so fail fast saves device time by cutting the retry pass short.
You can combine fail fast with automatic reruns. Fail fast only counts a flow as failed once its retries are exhausted.
What happens when a build stops
Reaching the fail-fast threshold halts the build gracefully at the next flow boundary:
- In-progress flows: Run to completion and keep their real result. BrowserStack never stops a running flow mid-execution.
- Flows not yet started: Marked as skipped rather than failed, so your failure count stays accurate.
On iOS, a Maestro session stopped by fail fast currently shows the reason runtime-error on the dashboard, instead of a build-aborted status. The build still stops as configured. A fix for this label is in progress.
Related topics
-
Use run failures only to start a new build that reruns only the flows that failed in a previous, completed build, instead of a build you stopped with fail fast.
-
See Test orchestration on Maestro for all supported strategies.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!