Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Load testing with Selenium Jest

Run a load test using Selenium with Jest scripts on BrowserStack Load Testing

Prerequisites

  • BrowserStack Username and Access key. You can find these under your account profile.
  • An existing automated test suite written in Selenium with Jest (Node.js 18 or later).
  • A package.json file at the root of your project that declares jest and a Selenium WebDriver package (for example, selenium-webdriver).

Before you zip and upload your project, replace any local WebDriver instances with a RemoteWebDriver call so the tests run against the BrowserStack hub. For example, change new Builder().forBrowser('chrome').build() to new Builder().usingServer('http://localhost:4444/wd/hub').forBrowser('chrome').build().

Supported versions

The following framework versions are recommended for Selenium Jest load tests:

Framework Node version Recommended version
Selenium Jest Node.js 21 Selenium WebDriver 4.25.0
Jest 29.7.0

Run a test

Based on your preferred method of performing load tests, use one of the following methods:

You can start a new test either from the Quick Start page or the Load Tests page on the Load testing dashboard.

On the dashboard, click Create Load Test.

Screenshot of load testing dashboard showing the run a new test button highlighted

Enter a Test Name for your load test, select Browser Only and click Upload scripts.

Dashboard showing test name field and type of load test to run

Upload scripts

In this step, upload your Selenium Jest automation project as a ZIP file. Select Selenium - Jest from the framework dropdown, then drag and drop your ZIP file (up to 250 MB) or click to select it.

Load Sources step with Upload Automation Project selected and Selenium - Jest chosen in the framework dropdown, ready to upload a ZIP project.

After you upload your ZIP file, the dashboard automatically validates your project. If validation is successful, you see a confirmation message and a summary of the detected dependencies.

From the Select dependencies dropdown, select your package.json file to specify which dependencies to install for your tests.

Ensure that your package.json sits at the root level of your project and declares both jest and a Selenium WebDriver package (for example, selenium-webdriver).

Uploaded Selenium - Jest project validated successfully, with the detected package.json selected in the Select dependencies dropdown.

Jest discovers tests by naming convention: files matching *.test.js, *.spec.js, or files inside a __tests__/ directory. You do not need to set a run target. To narrow the discovery set, use testMatch or testPathIgnorePatterns in your jest.config.js.

Once you have verified the configuration, click Configure Load to move to the next step.

You can also run load tests using the sample scripts if you want to try out the feature before uploading your own files. Use our Selenium Jest load testing sample project to quickly get started.

You can configure the following load parameters to customize your load test:

Run test

After you finish configuring load parameters, click RUN TEST.

If you run into issues, try the troubleshooting steps or contact us for help.

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