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.jsonfile at the root of your project that declaresjestand 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().
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.

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

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.

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).

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.
Install BrowserStack Node.js SDK
Run the given command from the root of your Selenium Jest project to install the BrowserStack Node.js SDK as a dev dependency.
The Load Testing CLI is bundled with the BrowserStack Node.js SDK. If you have already installed the SDK, you can skip this step.
Initialize your project for load testing
Run the following command from the root directory of your Selenium Jest test project to generate the browserstack-load.yml file, which contains the configuration required to define and run your load test.
Refer to the given table to use the framework and language combination argument:
| Framework | Argument |
|---|---|
| Selenium - Jest | --framework jest --language nodejs |
Configure your Load Test
Open the generated browserstack-load.yml file and update it with the relevant Selenium Jest test details. Use it to define your virtual users, duration, load profile, and regions.
Specify the test type
testType defines the type of load test that you want to execute. Currently, Playwright, Selenium, WebdriverIO, and Nightwatch are supported. Set this to Selenium for a load test using a Selenium test suite.
Specify the language
Set the language to nodejs.
Specify the test framework
Set the framework to jest.
Specify the path to your dependency file
The files block specifies the key files required to install dependencies and define which tests to execute.
- Under
dependencies, add the path to yourpackage.jsonfile. BrowserStack uses this file to runnpm installbefore invoking Jest. - You do not need to specify a
runTarget. Jest auto-discovers tests using its naming convention (*.test.js,*.spec.js, or files inside a__tests__/directory). To narrow the test set, configuretestMatchortestPathIgnorePatternsin yourjest.config.jsfile.
Ensure all referenced files are relative to the project root.
Do not include the node_modules directory in your ZIP. BrowserStack runs npm install from your package.json before invoking npx jest, so any pre-bundled node_modules is redundant and counts against the 250 MB upload limit.
Set reporting structure
Use projectName to group related tests under the same project on the dashboard. Use testName to group multiple runs of the same test.
Both projectName and testName must remain consistent across different runs of the same test.
You can use the following characters in projectName and testName:
- Letters (A to Z, a to z)
- Digits (0 to 9)
- Periods (
.), colons (:), hyphens (-), square brackets ([]), forward slashes (/), at signs (@), ampersands (&), single quotes ('), and underscores (_)
All other characters are ignored.
You can configure the following load parameters to customize your load test:
- Load profiles
- Load zones
- Set thresholds
- Per-VU external inputs with test data
- Environment variables
- Configure multiple scenarios
- Capture response details
- Network throttling
Run the Load Test
Run the load test from the root of your Selenium Jest project using the Load Testing CLI.
Before running a full-scale load test, do a sanity check with a small set of virtual users to validate your Selenium Jest configuration and test stability.
View test results
When the test runs, you get a link to the result dashboard, where you can analyze key metrics such as:
- Response time
- Request throughput
- Web vitals (LCP, CLS, INP, and others)
- Errors and bottlenecks
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
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!