Quick start guide to integrate BrowserStack Test Observability with Cucumber JS
Prerequisites
You have an account with BrowserStack (even a free trial works) and can get the Username and Access Key from your account profile.
You have a Cucumber JS test suite (it is okay even if you do not run your tests on BrowserStack infrastructure).
Node v12+ installed on your machine.
Integrate with Test Observability
BrowserStack Test Observability can be used regardless of where your tests run - whether on BrowserStack’s devices and browsers, locally on your laptop, CI machines, or using another cloud provider.
Not only that, Test Observability is agnostic to the type of testing and hence you could also integrate it with your unit or integration test suite written using CodeceptJS.
Please select your setup below to get started with an awesome debugging experience with Test Observability:
Install the latest version of the browserstack-node-sdk npm package
Install the BrowserStack SDK using npm for your Cucumber JS based test suite for plug-and-play integration with BrowserStack.
The npx setup command generates a browserstack.yml file at the root location of your project with your access credentials already configured. It also adds new command(s) in your package.json file to run tests on BrowserStack.
Please ensure that you have at least browserstack-node-sdk v1.34.8 before proceeding.
If you’ve installed the browserstack-node-sdk for the first time, you’d have to create the browserstack.yml file shown below. Else, just verify that your config file has all the required key-value pairs.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Create a browserstack.yml file in the root folder of your test suite if it doesn’t exist.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
testObservability: true
browserstackAutomation: false # Set to true for tests on BrowserStack products.
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
...
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
testObservability: true
browserstackAutomation: false# Set to true for tests on BrowserStack products.
CUSTOM_TAG_1: "You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need....
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate integration guide.
Run your suite with BrowserStack Test Observability
Run your test script in the following format:
```bash
npm run [your-test-script-name]-browserstack
```
Post build run completion, you will see the build URL of Test Observability in your console. Alternatively, you can also navigate to your build run using Build Runs.
Install the latest version of the browserstack-node-sdk npm package
Install the BrowserStack SDK using npm for your Cucumber JS based test suite for plug-and-play integration with BrowserStack.
The npx setup command generates a browserstack.yml file at the root location of your project with your access credentials already configured. It also adds new command(s) in your package.json file to run tests on BrowserStack.
Please ensure that you have at least browserstack-node-sdk v1.34.8 before proceeding.
If you’ve installed the browserstack-node-sdk for the first time, you’d have to create the browserstack.yml file shown below. Else, just verify that your config file has all the required key-value pairs.
The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack Automate or App Automate as Test Observability will automatically identify different build runs.
Restrict the characters in your projectName and buildName to alphanumeric characters (A-Z, a-z, 0-9), underscores (_), colons (:), and hyphens (-). Any other character will be replaced with a space.
Create a browserstack.yml file in the root folder of your test suite if it doesn’t exist.
```yml
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
testObservability: true
browserstackAutomation: true
CUSTOM_TAG_1: "You can set a custom Build Tag here"
# Use CUSTOM_TAG_<N> and set more build tags as you need.
...
```
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
testObservability: true
browserstackAutomation: true
CUSTOM_TAG_1: "You can set a custom Build Tag here"# Use CUSTOM_TAG_<N> and set more build tags as you need....
BrowserStack SDK is a very powerful tool that you can use to set the different browser/device combinations and parallelization. For more details, check out the Automate integration guide.
Run your suite with BrowserStack Test Observability
Run your test script in the following format:
```bash
npm run [your-test-script-name]-browserstack
```
Post build run completion, you will see the build URL of Test Observability in your console. Alternatively, you can also navigate to your build run using Build Runs.
Install the latest version of the browserstack-node-sdk npm package
Install the BrowserStack SDK using npm for your Cucumber JS based test suite for plug-and-play integration with BrowserStack.
The npx setup command generates a browserstack.yml file at the root location of your project with your access credentials already configured. It also adds new command(s) in your package.json file to run tests on BrowserStack.
Please ensure that you have at least browserstack-node-sdk v1.34.8 before proceeding.
Post build run completion, you will see the build URL of Test Observability in your console. Alternatively, you can also navigate to your build run using Build Runs.