Skip to main content

Test Observability on MochaJS

Quick start guide to integrate BrowserStack Test Observability with MochaJS

Test Observability is currently in private-alpha. If you do not yet have access to the product, you can reach out to us requesting early access.

Pre-requisites

  • You have an account with BrowserStack (even free trial works) and cen get the username and access key from Settings.
  • You have a mocha test suite (its okay even if you do not run your tests on BrowserStack infrastructure)

Integrate with Test Observability

You can use BrowserStack Test Observability both when you’re using BrowserStack’s devices and browsers to run your tests and also if you’re running tests locally on your laptop/CI system or even when you’re using some other cloud provider.

Please select your setup below to get started with awesome debugging experience with Test Observability:

To start using BrowserStack Test Observability with your existing setup of mochaJS tests running on BrowserStack Automate or App Automate, follow the steps below:

Install the latest version of browserstack-node-sdk npm package

You’d need to install/update the browserstack-node-sdk as shown below:

Terminal
Copy icon Copy snippet

Make changes to the SDK config file

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.

Create browserstack.yml file in the root folder of your test suite if it doesn’t exist.

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 since Test Observability will automatically identify different build runs.

browserstack.yml
Copy icon Copy snippet

BrowserStack SDK is a very powerful tool which 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

Prepend browserstack-node-sdk to the existing command that you use to trigger a run as shown below and data will automatically start getting sent to BrowserStack Test Observability.

Terminal
Copy icon Copy snippet

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 through Test Observability dashboard.

Visit Test Observability Dashboard

To start using BrowserStack Test Observability with your mochaJS tests running locally/CI or even on any other cloud platform, follow the steps below:

Install the latest version of browserstack-node-sdk npm package

You’d need to install the browserstack-node-sdk as shown below:

Terminal
Copy icon Copy snippet

Create the SDK config file

Create browserstack.yml file in the root folder of your test suite and copy the below code into it.

browserstack.yml
Copy icon Copy snippet

Run your suite with BrowserStack Test Observability

Prepend BROWSERSTACK_AUTOMATION=false browserstack-node-sdk to the existing command that you use to trigger a run as shown below and data will automatically start getting sent to BrowserStack Test Observability.

Terminal
Copy icon Copy snippet

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 through Test Observability dashboard.

Visit Test Observability Dashboard

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 an Expert
Download Copy