Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Test Reporting & Analytics on Cypress

Quick start guide to integrate BrowserStack Test Reporting & Analytics with Cypress

Prerequisites

  • You have an account with BrowserStack (even a free trial works) and can get your Username and Access Key from your account profile.
  • You have a Cypress v10 or above test suite (it is okay even if you do not run your tests on BrowserStack infrastructure).

Integrate with Test Reporting & Analytics

BrowserStack Test Reporting & Analytics 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.

Test Reporting & Analytics currently doesn’t support other test reporters like Mochawesome. If any are set up, they are automatically disabled.

Please select your setup below to get started with an awesome debugging experience with Test Reporting & Analytics:

Follow these steps to start using BrowserStack Test Reporting & Analytics with your existing setup of Cypress tests running on BrowserStack Automate.

Install the latest version of the browserstack-cypress-cli npm package

Update the browserstack-cypress-cli using the following commands.

Terminal
Copy icon Copy

Make changes to the browserstack.json file

If you’ve installed the browserstack-cypress-cli for the first time, you’d have to create the browserstack.json file in the root of your directory. Else, just verify that your config file has all the required key-value pairs as in the following snippet:

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 Reporting & Analytics 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 (:), square brackets ([, ]), and hyphens (-). Any other character will be replaced with an underscore (_).

browserstack.json
Copy icon Copy

test-observability is true by default unless the following configuration is present:

"downloads": [
      "./results"
    ]

Make changes to the cypress.config.js file

You’ll need to make a minor modification to the cypress.config.js file to import and use the Test Reporting & Analytics plugin while your tests run. Ensure the lines mentioned in the sample file below are present in your config file.

cypress.config.js
Copy icon Copy

Run your suite with BrowserStack Test Reporting & Analytics

Use the existing command that you use to trigger a run as shown below and data will automatically start getting sent to BrowserStack Test Reporting & Analytics.

Terminal
Copy icon Copy


Post build run completion, you will see the build URL of Test Reporting & Analytics in your console. Alternatively, you can also navigate to your build using Build Runs.


Visit Test Reporting & Analytics

Follow these steps to start using BrowserStack Test Reporting & Analytics with your existing setup of Cypress tests running locally or on another cloud.

Install the latest version of the browserstack-cypress-cli npm package

Install the browserstack-cypress-cli using the following commands.

Terminal
Copy icon Copy

Create the browserstack.json file

Create the browserstack.json file in the root of your directory with the following key-value pairs.

browserstack.json
Copy icon Copy

test-observability is true by default unless the following configuration is present:

"downloads": [
      "./results"
    ]

Modify the cypress.config.js file

You’ll need to make a minor modification to the cypress.config.js file to import and use the Test Reporting & Analytics plugin while your tests run. Ensure the lines mentioned in the sample file below are present in your config file.

cypress.config.js
Copy icon Copy

Run your suite with BrowserStack Test Reporting & Analytics

Use the existing command that you use to trigger a run and data will automatically start getting sent to BrowserStack Test Reporting & Analytics.

Terminal
Copy icon Copy


Post build run completion, you will see the build URL of Test Reporting & Analytics in your console. Alternatively, you can also navigate to your build run using Build Runs.


Visit Test Reporting & Analytics

Troubleshooting & FAQs

Why am I getting `Error loading the reporter` in my terminal?

You might get the following error in your Terminal when you try running tests:

Error loading the reporter: browserstack-cypress-cli/bin/testObservability/reporter

We searched for the reporter in these paths:

 - ./browserstack-cypress-cli/bin/testObservability/reporter
 - ./node_modules/browserstack-cypress-cli/bin/testObservability/reporter


If you get this error, try running the prescribed test command with --force-upload appended.

For example:

npx browserstack-cypress run <any other flags like --spec, --sync etc.> --force-upload

Why am I getting `Error: Cannot not find module` in my terminal?

You might get the following error in your Terminal when you try running tests:

Error: Cannot find module './node_modules/browserstack-cypress-cli/bin/testObservability/reporter'


If you get this error, try running the prescribed test command with --force-upload appended.

For example:

npx browserstack-cypress run <any other flags like --spec, --sync etc.> --force-upload

Why is my existing test reporter not working when I run tests using Test Reporting & Analytics?

When you use Test Reporting & Analytics, your existing reporters (like mochawesome) are automatically disabled. In order to use your existing reporter again, please disable Test Reporting & Analytics by setting "testObservability": false in your browserstack.json file.

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