Reuse devices across sessions to reduce start time
Reuse devices across consecutive Appium sessions on BrowserStack App Automate to skip full device resets and reduce start time.
BrowserStack App Automate allocates a fresh real device for every Appium test session by default. The standard teardown between sessions uninstalls the app and resets the device state. This adds 30 to 50 seconds to every session.
When a continuous integration build runs dozens of short test cases with the same capabilities, this setup overhead can take up most of the pipeline time. Enabling device reuse skips full device resets and keeps allocated devices active between consecutive sessions in the same build.
For background on how device setup contributes to overall test time, see start time in Optimize execution time and performance on App Automate.
How device reuse works
When BrowserStack receives a new session with device reuse enabled, it checks for a device reserved by an earlier session in the same build. That device must match the same capabilities:
- If BrowserStack finds a match, it reuses that device and skips expensive setup steps such as app download, Appium version switching, and network setup.
- If BrowserStack finds no match, it allocates a device normally and reserves it for your next matching session.
Consecutive sessions that reuse a device are called chained sessions. Between chained sessions, BrowserStack runs a minimal cleanup instead of a full teardown. It resets app state and runs health checks only.
After a session completes successfully, BrowserStack holds the device in a reserved state for about 30 seconds. Your next matching session can claim it in that window.
If no matching session arrives in that window, BrowserStack releases the device back to the general pool and allocates a fresh device for your next session as normal.
When device reuse helps most
Consider enabling this capability when your build matches most of the following:
- Your build runs many sessions, dozens or more, that share the same capabilities.
- Your sessions are short and atomic. Each session runs one focused scenario instead of a long, combined flow.
- Start time is 40 seconds or more and makes up a large share of your total session duration.
If your session start time is already under 30 to 35 seconds, the reservation wait and minimal cleanup can exceed the time you save. Device reuse may not help in that case.
- Device reuse is best effort. BrowserStack does not guarantee the same physical device across chained sessions.
- Minimal cleanup resets app state and runs health checks only. Do not rely on device reuse if your tests need a fully reset device for every session.
- Avoid combining device reuse with
noResetset totrue, and avoid it in tests that uninstall the app at the end of a run. Both can carry state from one session into the next chained session. - Device reuse does not reserve a dedicated or private device for you. It only lets consecutive matching sessions reuse a device when one is available.
Set the capability
Set the reuseDevice capability using the flow that matches your test setup.
If you use the BrowserStack SDK, set the reuseDevice capability to true in your browserstack.yml file:
Related topics
- Optimize execution time and performance on App Automate: understand how start time, queuing, and session duration make up your total App Automate execution time.
- Capabilities and their performance impact: see which other capabilities affect start time and session duration.
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!