Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & App Percy
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Enable Local Testing for Espresso tests

Enable Local Testing to test Android apps that retrieve data from local servers, private staging environments, or CI/CD nodes behind a firewall.

Get your Espresso tests to securely access local servers, staging environments, or firewalled CI/CD nodes by enabling BrowserStack Local Testing.

Establish a Local Testing connection

You can start a Local Testing connection through your command-line interface by following the steps below:

Download the binary

The download links are secure. The binaries are digitally signed, identifying the publisher as ‘BrowserStack Ltd’.

Start the tunnel

Navigate to the binary folder in your terminal and run:

./BrowserStackLocal --key YOUR_ACCESS_KEY
BrowserStackLocal.exe --key YOUR_ACCESS_KEY

Common enterprise flags: If you are behind a corporate proxy or need to force all traffic through the tunnel, use these flags:

  • Proxy: --proxy-host <host> --proxy-port <port>

  • Force Local: --force-local (Routes all traffic through your machine, not just local URLs)

  • Local Identifier: --local-identifier <ID> (Required if running multiple tunnels in parallel)

Configure your Espresso execution

Once the tunnel is active (it stays open in your terminal), you must tell BrowserStack to route your Espresso build through it by setting the local capability to true.

Capability Description Value
local Test against internal/local servers true/ false
Default: false

REST API integration

Update your POST REST API request to the /build endpoint:

Terminal
Copy icon Copy

For more information on REST API usage, refer to the App Automate Espresso REST API documentation.

Best practices

The following best practices help you optimize your Local Testing experience:

Feature Recommendation
Execution order Start the binary before triggering the cURL request. Kill the binary process only after the API returns the results.
Idling If the tunnel is idle for too long, it may disconnect. Ensure your test starts within 5 minutes of opening the tunnel.
CI/CD In Jenkins or GitHub Actions, use the BrowserStack SDK or the official plugins to automate the starting/stopping of this binary.

Troubleshooting the connection

If your Espresso tests are failing to reach your local API, try the following steps:

  1. Check the dashboard: On the App Automate Dashboard, look for the “Local Testing” indicator in your test session details.

  2. DNS resolution: Try accessing your local server via IP address (e.g., http://192.168.1.5:8080) instead of localhost if the app fails to resolve the host.

  3. Logs: Check the local.log file generated in the same directory as the binary for connection errors.

Screenshot showing the Local Testing green indicator on the BrowserStack App Automate dashboard for an Espresso test session

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