Options reference
Options configure test-run behavior. Use options to define test tags, thresholds, user agents, the number of virtual users and iterations, and much more.How to use options
You can set options in multiple places with different levels of precedence:1
In the script
Use the
export const options object to set default options in your script.2
Command-line flags
Override script options with CLI flags.
3
Environment variables
Use environment variables with the
K6_ prefix.Order of precedence
When you set options in multiple places, k6 applies them in this order (highest to lowest precedence):- Command-line flags
- Environment variables
- Script options
- Default values
Common options
Virtual users and duration
integer
default:"1"
Number of virtual users to run concurrently.
string
default:"null"
Total test duration. The test will run for this duration with the specified number of VUs.
integer
default:"1"
Total number of iterations to execute across all VUs.
Stages
array
default:"[]"
Ramp VUs up or down during the test.
Thresholds
object
default:"{}"
Pass/fail criteria for metrics.
Scenarios
object
default:"{}"
Advanced configuration for VU and iteration scheduling.
Complete options list
Here’s the complete list of k6 options:Execution options
vus- Number of virtual usersduration- Test durationiterations- Total iterationsstages- VU ramping configurationscenarios- Advanced scenario configurationexecutionSegment- Segment of test to runexecutionSegmentSequence- Sequence for segmentation
HTTP options
batch- Max parallel requests in batchbatchPerHost- Max parallel requests per hosthttpDebug- HTTP request/response logginginsecureSkipTLSVerify- Skip TLS verificationtlsAuth- TLS client certificate configurationtlsCipherSuites- TLS cipher suitestlsVersion- Min/max TLS versions
Output options
noConnectionReuse- Disable keep-aliveuserAgent- User-Agent header valuediscardResponseBodies- Don’t save response bodiesrps- Max requests per second
Lifecycle options
setupTimeout- Setup function timeoutteardownTimeout- Teardown function timeoutmaxRedirects- Max HTTP redirects
Tags
tags- Tags applied to all metricssystemTags- System tags to collect
Console output
noVUConnectionReuse- Per-VU connection behaviorminIterationDuration- Minimum iteration durationmaxDuration- Maximum test duration
Examples
Load test with ramping
Spike test
Using environment variables
Related resources
Test lifecycle
Learn about the test execution lifecycle
Scenarios
Advanced VU and iteration scheduling
Thresholds
Set pass/fail criteria for your tests
Environment variables
Using environment variables in k6