Run Tests in Dev Environments

Learn how to test localhost and staging websites without publicly hosting them.

Local Testing

BrowserStack enables you to run automated tests on your internal development environments, on localhost, staging setups or from behind a corporate firewall. This feature is called Local Testing.

Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all your private URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.

Note: Learn more about how Local Testing works so you can set up your CI/CD workflows better!

Setting up Local Testing

First, you will need to download the Local binary. Choose one based on the operating system of your machine - OS X | Linux (32-bit) | Linux (64-bit) | Windows

Next, unzip the file that you downloaded, and establish the Local Testing connection using the following command in terminal/command prompt:

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

Once the connection is established, you can use local key in the connection_settings option to specify the Local connection settings in the browserstack.json configuration file, like this:

browserstack.json
...
{
  "connection_settings": {
    "local": true
  }
}
...

Alternatively, you can set the environment variable BROWSERSTACK_LOCAL to true. Note that the environment variable will override the options in your browserstack.json.

Important: You have to configure Local Testing connection with an identifier if you are already using another Local connection for running your Selenium tests, JS tests or another Cypress build.

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 automation expert