Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

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:

Terminal
Copy icon Copy

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:

  • maxFailures accepts an integer from 1 to 1000.
  • Setting enabled to true without maxFailures fails 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.

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy Check Circle