A command line interface to run browser tests over BrowserStack
A command line interface to run browser tests over BrowserStack.
npm -g install browserstack-runner
Then, after setting up the configuration, run tests with:
You can also install locally and run the local binary:
npm install browserstack-runner node_modules/.bin/browserstack-runner
If you're getting an error
EACCES open ... BrowserStackLocal, configure npm to install modules using something other than the default "nobody" user:
npm -g config set user [user]
[user] is replaced with a local user with enough permissions.
To run browser tests on BrowserStack infrastructure, you need to create a
browserstack.json file in project's root directory (the directory from which tests are run), by running this command:
username: BrowserStack username (Or
key: BrowserStack access key (Or
test_path: Path to the test page which will run the tests when opened in a browser.
test_framework: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine2 and mocha.
timeout: Specify worker timeout with BrowserStack.
browsers: A list of browsers on which tests are to be run. Find a list of all supported browsers and platforms on browerstack.com.
build: A string to identify your test run in Browserstack. In
TRAVIS_COMMITwill be the default identifier.
proxy: Specify a proxy to use for the local tunnel. Object with
A sample configuration file:
os_version granularity is not desired, following configuration can be used:
[browser]_currentor browser_latest: will assign the latest version of the browser.
[browser]_previous: will assign the previous version of the browser.
[browser]_[version]: will assign the version specificed of the browser. Minor versions can be concatinated with underscores.
This can also be mixed with fine-grained configuration.
Add the following in
To avoid duplication of system or user specific information across several configuration files, use these environment variables:
BROWSERSTACK_USERNAME: BrowserStack user name.
BROWSERSTACK_KEY: BrowserStack key.
TUNNEL_ID: Identifier for the current instance of the tunnel process. In
TRAVIS_JOB_IDwill be the default identifier.
BROWSERSTACK_JSON: Path to the browserstack.json file. If null,
browserstack.jsonin the root directory will be used.
To avoid checking in the BrowserStack
key in your source control system, the corresponding environment variables can be used.
These can also be provided by a build server, for example using secure environment variables on Travis CI.