Test locally from CI/CD machines

A simple guide to help you run tests using localhost or staging environments.

Local Testing

BrowserStack enables you to run your Javascript unit tests on your internal development environments, on localhost, from behind a proxy, or from behind a corporate firewall. This feature is known as Local Testing on BrowserStack.

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

Usual way of setting up Local Testing

You will just have to download the BrowserStack Local binary based on the OS you are on: OS X, Linux 32-bit, Linux 64-bit, Windows. The download links are secure and all the binaries are digitally signed, identifying the publisher as BrowserStack Ltd.

Navigate to the folder containing the binary, and run it from the command line.

Command Line
BrowserStackLocal --key YOUR_ACCESS_KEY

Read more about the various args available for the Local Binary.

Using one of the test runners

If you are already using one of the test runners, you don’t need to additionally download browserstack-local as the test runner automatically downloads it and sets up the Local Testing connection.

For example, karma-browserstack-launcher has a dependency on browserstack-local and downloads it. You can set local modifiers in the browserStack hash:

karma.conf.js
browserStack: {
    username: 'YOUR_USERNAME',
    accessKey: 'YOUR_ACCESS_KEY',
    verbose: 2,
    log-file: '<path of file where you want to log local binary logs>'
},

Next Steps

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