Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 2.18 KB

README.md

File metadata and controls

40 lines (26 loc) · 2.18 KB

browserstack-webdriverio-load-testing-sample

This repo contains samples for running WebdriverIO tests on BrowserStack using the browserstack-node-sdk.

BrowserStack Logo

Setup

  • Clone the repo git clone https://github.com/browserstack/browserstack-webdriverio-load-testing-sample.git.
  • Set your credentials as environment variables, as described in Set your credentials.
  • Run npm i to install the dependencies.
  • Open browserstack-load.yml and update it with the relevant load test configurations. Leave userName and accessKey as they are.

Set your credentials

The BrowserStack CLI reads your credentials from environment variables. Copy your username and access key from Account Settings and export them in the shell you run the test from:

On macOS or Linux (bash or zsh), run the lines below. The second one prompts for the key without echoing it, so the key stays out of your shell history:

export BROWSERSTACK_USERNAME="<your-username>"
printf 'BrowserStack access key: '; read -rs BROWSERSTACK_ACCESS_KEY; echo; export BROWSERSTACK_ACCESS_KEY

On Windows, run these in PowerShell. The second line prompts for the key in the same way:

$env:BROWSERSTACK_USERNAME = "<your-username>"
$env:BROWSERSTACK_ACCESS_KEY = [System.Net.NetworkCredential]::new('', (Read-Host -AsSecureString 'BrowserStack access key')).Password

These variables last only for the current terminal session. If the CLI reports an authentication error, check that both are set in the terminal you run it from.

Never commit your credentials. Leave the userName and accessKey placeholders in browserstack-load.yml as they are (the environment variables override them), and keep your access key out of every file you push. If a key is ever exposed, regenerate it from Account Settings.

Running your tests

  • Run the given command to start your test: npx browserstack-cli load run.

Notes