Hybrid load testing using Selenium Jest with JMeter or k6
Run a hybrid 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 JMeter script and an automated test suite written in Selenium with Jest (Node.js 18 or later).
- A
package.jsonfile at the root of your Selenium Jest project that declaresjestand a Selenium WebDriver package (for example,selenium-webdriver).
Before you zip and upload your Selenium Jest 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 Hybrid and click Upload scripts.

Upload your scripts
BrowserStack runs a hybrid test using JMeter and Selenium Jest automation projects. JMeter generates API-level load, and Selenium with Jest drives browser-level load to simulate real user interactions.
You see two sections:
-
JMeter Script: Upload your JMeter
.jmxfile (up to 50 MB). Drag and drop your file or click to select it. -
Automation Project: Select Selenium - Jest from the dropdown as your automation framework. Then, upload your zipped project files (
.zipup to 250 MB). Drag and drop the file or click to select it.

After you upload your ZIP file, the dashboard automatically validates your project. From the Select dependencies dropdown, select your package.json file so BrowserStack knows 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.
Both fields are mandatory for their respective test types. After uploading, click Configure Load to proceed to the next step.
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 hybrid load test:
Refer to the given table to use the framework and language combination argument:
| Framework | Argument |
|---|---|
| Selenium Jest + JMeter | --framework jest jmeter --language nodejs |
Configure your load test
Open the generated browserstack-load.yml file and update it with the relevant Selenium Jest and JMeter test details. Use it to define your virtual users, duration, load profile, and regions.
Specify number of virtual users
Set vus to the maximum number of virtual users to simulate during the test.
The max limit for this config is currently 100. Contact us if you want to increase this limit.
Before running a full-scale load test, do a sanity check with a small set of virtual users to validate your configuration and test stability.
Specify the tests
- The
testsblock defines the combination of test types you want to run as part of a hybrid load test. SpecifySeleniumas thetestTypefor one sub-block andJMeterfor another. - For the
Seleniumsub-block:-
browserLoadPercent: Specify the percentage of total virtual users to allocate to the Selenium tests. -
language: Set this tonodejs. -
framework: Set this tojest. -
files: Define the key files needed to install dependencies.- Under
dependencies, add the path to yourpackage.jsonfile. BrowserStack uses this file to runnpm installbefore invoking Jest.
- Under
- 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.
-
- For the
JMetersub-block:-
apiLoadPercent: Specify the percentage of total virtual users to allocate to the JMeter tests. -
testScripts: Set the path to the.jmxfile.
-
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
Run the load test
Run the given command to start your test from the root of your Selenium Jest project:
Before running a full-scale hybrid load test, do a sanity check with a small set of virtual users to validate your Selenium Jest configuration, JMeter or k6 setup, 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
Prerequisites
- BrowserStack Username and Access key. You can find these under your account profile.
- An existing k6 script and an automated test suite written in Selenium with Jest (Node.js 18 or later).
- A
package.jsonfile at the root of your Selenium Jest project that declaresjestand a Selenium WebDriver package (for example,selenium-webdriver).
Before you zip and upload your Selenium Jest 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 Hybrid and click Upload scripts.

Upload your scripts
BrowserStack runs a hybrid test using k6 and Selenium Jest automation projects. k6 generates API-level load, and Selenium with Jest drives browser-level load to simulate real user interactions.
You see two sections:
-
k6 Script: Upload your k6
.jsfile (up to 50 MB). Drag and drop your file or click to select it. -
Automation Project: Select Selenium - Jest from the dropdown as your automation framework. Then, upload your zipped project files (
.zipup to 250 MB). Drag and drop the file or click to select it.

After you upload your ZIP file, the dashboard automatically validates your project. From the Select dependencies dropdown, select your package.json file so BrowserStack knows 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.
Both fields are mandatory for their respective test types. After uploading, click Configure Load to proceed to the next step.
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 hybrid load test:
Refer to the given table to use the framework and language combination argument:
| Framework | Argument |
|---|---|
| Selenium Jest + k6 | --framework jest k6 --language nodejs |
Configure your load test
Open the generated browserstack-load.yml file and update it with the relevant Selenium Jest and k6 test details. Use it to define your virtual users, duration, load profile, and regions.
Specify number of virtual users
Set vus to the maximum number of virtual users to simulate during the test.
The max limit for this config is currently 100. Contact us if you want to increase this limit.
Before running a full-scale load test, do a sanity check with a small set of virtual users to validate your configuration and test stability.
Specify the tests
- The
testsblock defines the combination of test types you want to run as part of a hybrid load test. SpecifySeleniumas thetestTypefor one sub-block andk6for another. - For the
Seleniumsub-block:-
browserLoadPercent: Specify the percentage of total virtual users to allocate to the Selenium tests. -
language: Set this tonodejs. -
framework: Set this tojest. -
files: Define the key files needed to install dependencies.- Under
dependencies, add the path to yourpackage.jsonfile. BrowserStack uses this file to runnpm installbefore invoking Jest.
- Under
- 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.
-
- For the
k6sub-block:-
apiLoadPercent: Specify the percentage of total virtual users to allocate to the k6 tests. -
testScripts: Set the path to the.jsfile.
-
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
Run the load test
Run the given command to start your test from the root of your Selenium Jest project:
Before running a full-scale hybrid load test, do a sanity check with a small set of virtual users to validate your Selenium Jest configuration, JMeter or k6 setup, 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
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!