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

Run a load test using your script’s own configuration and thresholds

Run your k6 or JMeter script on BrowserStack using its own load configuration and thresholds, just like a local run.

The test behaves and passes or fails the same way as a local run. This guide is for performance and QA engineers who author their own scripts.

What BrowserStack reads from your script

Depending on your script type, BrowserStack honors different fields for load and for pass or fail thresholds:

k6 declares its load shape and its pass or fail criteria in the same place: the options object.

What BrowserStack reads Source Examples
Load shape options vus, duration, stages, scenarios, iterations
Pass or fail thresholds options.thresholds http_req_duration: ['p(95)<500'], http_req_failed: ['rate<0.01'], checks: ['rate>0.95']

A threshold BrowserStack can’t grade, for example a k6 threshold scoped to a specific tag or sub-metric, still appears in the grid, grayed out, with a warning. It runs inside your script, but it doesn’t decide the BrowserStack pass or fail verdict. Hover over the warning for the reason.

Prerequisites

To use this feature, you need:

  • A BrowserStack Load Testing project.
  • Either of the following:
    • A k6 script that sets options, such as vus, duration, stages, or scenarios. To gate the run on your own criteria, also set options.thresholds.
    • A JMeter .jmx plan whose thread groups define the load. To gate the run using thresholds, add Duration or Response assertions.

If your script declares neither, BrowserStack uses the values you set in the UI Builder or pass via the CLI.

How BrowserStack reads your script

Your script takes priority wherever it declares a value. BrowserStack parses the script, uses the load shape and thresholds it finds, and fills in anything the script leaves unset.

Plan limits always apply. If your script requires more virtual users than your plan allows, the run fails immediately with a clear error instead of being silently capped.

Steps

Follow these steps:

On the Load Testing dashboard, click Create Load Test.

Enter a test name, for example checkout-flow-stress, and select API Only as the test type.

Click Upload scripts and add your script:

  • k6: a single .js or .ts file, or a .zip file, up to 100 MB. For a multi-file test, set Main script to your entry file, for example tests/k6/checkout.js.
  • JMeter: a .jmx file, up to 50 MB.

Click Configure Load to open Step 3: Load Configuration.

On Load Definition, find the Script load configuration card. It shows what BrowserStack read from your script: peak virtual users, duration, and the number of scenarios (k6) or thread groups (JMeter).

Here’s what the Load Definition tab looks like with the script configuration card:

Script load configuration card showing VUs, duration, and scenarios

Click View details to see the complete breakdown across all configuration fields:

Load Definition tab showing Script load configuration card

View details panel showing configuration breakdown across two tabs

Turn on the toggle that runs the test using your script’s own configuration. When it’s on, the manual load fields are replaced by your script’s values.

Open the Thresholds tab. Under From your script, each threshold your script declares appears in a grid with the following columns:

Column Description
Metric The metric the threshold is on, for example http_req_duration or checks.
Condition The pass condition, for example p(95) < 500ms or rate < 1%.
Scope The traffic the threshold applies to, for example all requests.
On breach What happens if the threshold fails: fail at the end of the run, or abort the run.

Thresholds tab showing From your script grid with metric, condition, scope, and on-breach columns

You can also add custom thresholds in the UI in addition to the thresholds defined in your test script. Use the Custom thresholds section on the Thresholds tab to add more pass or fail criteria that apply alongside your script’s thresholds.

Click Run Test.

Verify it worked

The run report lists each threshold from your script with its own pass or fail result, and shows the effective configuration with each value attributed to your script or to the platform:

Run report showing thresholds summary with pass or fail results

Troubleshooting

BrowserStack can’t map it to a metric it grades, for example a tag-scoped k6 threshold. It still runs inside your script, but it doesn’t decide the BrowserStack verdict. Hover the warning for the specific reason.

Your script requests more virtual users than your plan allows. Lower the count in the script, or check your plan limit. BrowserStack doesn’t silently reduce it.

Either run-as-authored mode is off, or your script declares no thresholds. Turn the toggle on, or add options.thresholds for k6 or assertions for JMeter.

What’s next

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