# Review k6 Thresholds Before Running Generated Load

> A generated k6 script is a bounded first probe. Its fixed 200 check and default 500 ms limits need review against the endpoint contract.

- Author: [Shashank Rawlani](https://shashank.rawlani.com)

- Published: 2026-11-18T05:30:00.000Z

- Updated: 2026-11-18T05:30:00.000Z

- Category: Tools & Reviews

- Canonical source: https://automationtester.in/blog/tools-reviews/review-k6-script-thresholds-before-load

- Tags: k6, load-testing, performance, thresholds

The [k6 Script Generator](https://automationtester.in/tools/k6-generator) can give you a bounded first load probe: one request, a virtual-user count, a duration, and pass/fail thresholds. Before the run, inspect the generated checks. Their defaults may disagree with your endpoint’s contract.

A team asks whether an orders endpoint can handle a promotion. A form asking for “number of users” looks tempting, but five concurrent users for twenty seconds do not model a promotional arrival rate. The generator can build the first probe; sizing the real load still needs traffic evidence.

## Build a five-user probe

On the live page, set the endpoint to `https://api.example.test/orders`, leave the method at GET, set **Virtual Users** to `5`, and set **Duration** to `20s`. The generated options began exactly this way:

```
export const options = {
  vus: 5,
  duration: '20s',
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.01'],
  },
};
```

The script also sends `http.get()` with the default placeholder bearer header, checks for status 200 and a transaction time below 500 ms, then sleeps one second. Replace the placeholder token and test host with controlled values. Do not run the example URL: `example.test` is an illustrative host.

## Two different latency decisions

The `http_req_duration` threshold decides whether the entire run passes when its p95 is under 500 ms. The generated `check` compares each response’s `timings.duration` against 500 ms. Those are different questions. A handful of slow requests may fail checks while the run’s p95 still passes. Decide whether you need both signals, and set each from the service objective rather than from the form’s default.

The status check is hard-coded to 200. An endpoint whose successful POST returns 201 will mark every request as a failed check until you edit that line. The UI can flag an empty endpoint or invalid JSON body, but it cannot know your API’s status contract.

## When five users are the wrong input

Constant virtual users are useful for a first controlled probe. If the business question is “200 arrivals per second at peak,” choose a k6 arrival-rate scenario and derive the rate, journey mix, and test-data ownership from measurements. Running a load test against shared production dependencies without a coordinated plan can disturb other users.

## Run a bounded first pass

Generate a script for a test environment, edit the expected status and thresholds, then run `k6 run load-test.js`. Save the script, target environment, and summary together. The result is useful only when the load profile and endpoint behavior are stated.

## References for the run

- [k6 Script Generator](https://automationtester.in/tools/k6-generator): live generated script and form controls.
- [k6 thresholds](https://grafana.com/docs/k6/latest/using-k6/thresholds/): pass/fail expressions for metrics.
- [k6 constant VUs](https://grafana.com/docs/k6/latest/using-k6/scenarios/executors/constant-vus/): the executor behavior behind the generated load profile.

## Continue reading on AutomationTester.in

- [Write k6 Thresholds That Fail CI for the Right Reasons](https://automationtester.in/blog/automation-tutorials/k6-thresholds-fail-ci-right-reasons)
- [Build a k6 Load Model from Real Traffic, Not a VU Count](https://automationtester.in/blog/tools-reviews/generate-k6-load-model-traffic-assumptions)
- [Test Capacity Limits Before Production Finds Them](https://automationtester.in/blog/automation-tutorials/capacity-testing-bottlenecks-queues-pools)
- [Connect Load Tests to OpenTelemetry Traces](https://automationtester.in/blog/automation-tutorials/connect-load-tests-opentelemetry-traces)
- [Model Realistic Workloads with k6 Scenarios](https://automationtester.in/blog/automation-tutorials/k6-scenarios-realistic-workload-models)

Source: [Review k6 Thresholds Before Running Generated Load](https://automationtester.in/blog/tools-reviews/review-k6-script-thresholds-before-load) by Shashank Rawlani.
