Skip to main content
No Result Found

Test Observability on WebdriverIO

Quick start guide to integrating BrowserStack Test Observability with WebdriverIO

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 WebdriverIO test suite (its okay even if you do not run your tests on BrowserStack infrastructure).
  • You are using Node.js version 14 or above.

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 an awesome debugging experience with Test Observability:

Follow these steps to start using BrowserStack Test Observability with your existing setup of WebdriverIO tests running on BrowserStack Automate or App Automate:

Update to the latest version of the browserstack-service npm package

Go to your WebdriverIO project’s root directory and run the following commands to update the installed version of @wdio/browserstack-service and later check the installed version:

You need to install @wdio/browserstack-service if you’re not already using it and configure it using the following steps:

Terminal
npm update @wdio/browserstack-service
npm list @wdio/browserstack-service

# Please ensure that you have @wdio/browserstack-service v7.36.0 or above (if using WDIO v7) or v8.33.1 or above (if using WDIO v8)


Please ensure that you now have @wdio/browserstack-service v7.36.0 or above (if using WDIO v7) or v8.33.1 or above (if using WDIO v8), before proceeding.

Set up the config file

Your wdio.conf.js file should include the Username and Access Key as in the following code snippet:

wdio.conf.js
  exports.config = {
    //...
    user: 'YOUR_USERNAME' || process.env.BROWSERSTACK_USERNAME,
    key: 'YOUR_ACCESS_KEY' || process.env.BROWSERSTACK_ACCESS_KEY,
    services: [
        ['browserstack', {
            testObservability: true,
            testObservabilityOptions: {
                'projectName': 'Specify your project name here. It should not be dynamic',
                'buildName': 'Specify your job name here. For e.g. `Nightly regression`. It should not be dynamic',
                'buildTag': 'Any build tag goes here. For e.g. ["Tag1","Tag2"]'
            },
        }]
    ],
    //...
  };

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.

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.

Any other config parameters that are already existing can exist as it is.

Run your suite with BrowserStack Test Observability

Use your existing command that you use to trigger a run and data will automatically start getting sent to BrowserStack Test Observability.

Post build run completion, you will see the build URL of Test Observability. Alternatively, you can also navigate to your build run using Build Runs.

Visit Test Observability

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 Check Circle