Skip to main content
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Set thresholds for specific requests

Apply pass or fail criteria to a single request, a pattern, or a group of requests.

Test-level thresholds tell you whether the overall run passed or failed, but a healthy overall result can hide a single slow endpoint or a degraded group of requests. Set thresholds on specific requests to enforce limits where they matter, such as a payment API or your static assets, and catch localized regressions that test-level thresholds miss.

By default, a threshold applies to All Requests, which aggregates the metric across the entire test run. To target a regression more precisely, narrow the threshold to one of the following:

  • Single request: Apply a threshold to one request.
  • Request pattern: Apply a threshold to every request that matches a wildcard pattern.
  • Request group: Apply a threshold to a named or inline list of requests.

How requests are identified

What you target depends on the test type. Browser tests match on the request URL, k6 matches on the URL or a k6 tag, and JMeter matches on the sampler label.

Test type Single request Request pattern Request group
Browser Request URL Pattern for request URLs One or more request URLs
k6 Request URL or a k6 tag Pattern for URLs or tag names One or more URLs or tag names
JMeter Sampler label Pattern for sampler labels One or more sampler labels
Hybrid (Browser and k6) Request URL or a k6 tag Pattern for URLs or tag names URLs, tag names, or a mix
Hybrid (Browser and JMeter) Request URL or a sampler label Pattern for URLs or sampler labels URLs, sampler labels, or a mix

In Hybrid tests, when the same URL appears in both the browser and the API test, BrowserStack aggregates the results across both before it evaluates the threshold.

Set request thresholds

You can scope a threshold to a scenario in Browser Load Tests only, because multiple scenarios exist only in browser tests. On API Load Tests, a threshold applies globally or to specific requests, not to a scenario.

The available metrics and conditions are the same as test-level thresholds. For each threshold, you pick a request scope, and for multiple scenarios tests, a scenario scope. Select your preferred interface:

Set request thresholds in the UI

In Step 3/3: Load Configuration, open the Thresholds tab. Each threshold is one row where you choose a metric, a condition, and a value, then set its scope.

Use the for dropdown to choose which requests the threshold applies to:

  • All Requests: the aggregated metric across the entire test run. This is the default.
  • Single Request: a specific request only.
  • Request Pattern: the aggregated metric across requests that match a wildcard pattern.
  • Request Group: the aggregated metric across a list of requests.

The request scope dropdown showing All Requests, Single Request, Request Pattern, and Request Group options

For any scope other than All Requests, enter the request URL, k6 tag, or JMeter sampler label that applies to your test type. The UI guides you with framework-specific helper text and validates your entry.

For multiple scenarios tests, use the on dropdown to choose the scenario scope:

  • Across all scenarios: the aggregate of every scenario. This is the default.
  • Scenario name: that scenario only.

The scenario scope dropdown showing Across all scenarios and the individual scenario options

Select Add Threshold to add more thresholds, then save the test.

Named request groups, set with the group: prefix, are available only in the CLI. In the UI, use a request group to apply one threshold across several requests.

Set request thresholds in browserstack-load.yml

Add an optional request field to any entry in the thresholds block. Without a request field, the threshold applies to overall metrics, exactly as it does by default. With a request field, the threshold applies only to the requests you target.

Target a single request

Set request to an exact request URL, k6 tag, or JMeter sampler label.

browserstack-load.yml
Copy icon Copy

Target a pattern

Use * to match a single path segment and ** to match multiple segments. The threshold applies to every request that matches the pattern.

browserstack-load.yml
Copy icon Copy

Target an inline group

Pass a list of requests to apply one threshold across all of them.

browserstack-load.yml
Copy icon Copy

Reuse a named group

Define reusable groups under the top-level request-groups field, then reference a group from any threshold with the group: prefix. This keeps a single list that many thresholds can share.

browserstack-load.yml
Copy icon Copy

Scope a threshold to a scenario

For multiple scenarios tests, add a scenario field to evaluate the threshold within a single scenario. The value must match a scenario name in your config. Omit scenario to evaluate the threshold across all scenarios.

request and scenario are independent scopes. Combine them to evaluate a metric on a specific request within a specific scenario.

browserstack-load.yml
Copy icon Copy

The following rules apply to request thresholds:

  • For JMeter, replace URLs with sampler labels, such as request: "Process Payment".
  • For k6, you can target a request URL or a k6 tag.
  • Keep group: references on their own. You can’t mix a group: reference with URLs, tags, or labels in the same list.
  • Every group under request-groups needs a unique name and at least one entry.
  • The scenario field works only for browser tests. Adding it to an API test threshold returns an error.

When a request isn’t found

If a request, pattern, or group does not match anything in the test results, BrowserStack skips that threshold and marks it with a warning in the report. A skipped threshold does not count as a pass or a fail. For a partially matched group, BrowserStack evaluates the threshold on the requests it found and notes the missing ones.

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