← 返回命令列表

Linux command

k6 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Run load test

k6 run [script.js]

Run with virtual users

k6 run --vus [10] --duration [30s] [script.js]

Run with iterations

k6 run --iterations [100] [script.js]

Cloud execution

k6 cloud [script.js]

Output to JSON

k6 run --out json=[results.json] [script.js]

Pause threshold

k6 run --throw-on-abort [script.js]

说明

k6 is a modern load testing tool. It uses JavaScript for test scripts with a powerful API. The tool produces detailed performance metrics. It supports cloud execution and CI/CD integration.

参数

run _SCRIPT_
Run load test script.
cloud _SCRIPT_
Run on k6 Cloud.
--vus _N_
Virtual users.
--duration _TIME_
Test duration.
--iterations _N_
Total iterations.
--out _OUTPUT_
Output destination.
--help
Display help information.

FAQ

What is the k6 command used for?

k6 is a modern load testing tool. It uses JavaScript for test scripts with a powerful API. The tool produces detailed performance metrics. It supports cloud execution and CI/CD integration.

How do I run a basic k6 example?

Run `k6 run [script.js]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does run _SCRIPT_ do in k6?

Run load test script.