pressure-measurement

Crates.iopressure-measurement
lib.rspressure-measurement
version0.1.7
created_at2025-08-08 05:48:59.112218+00
updated_at2025-08-08 07:27:10.082126+00
description压力测试
homepage
repositoryhttps://gitee.com/itao007/pressure-measurement.git
max_upload_size
id1786231
size73,363
itao (bj-sjt)

documentation

https://docs.rs/pressure-measurement

README

压测工具

Usage: pm.exe [OPTIONS] [URL]

Arguments:
  [URL]  接口路径

Options:
  -c, --config <CONFIG>   指定配置文件,如果指定了配置文件,则其它参数将被忽略
  -m, --method <METHOD>   请求方法 [default: get] [possible values: get, post, put, delete]
  -H, --header <HEADERS>  请求头,如:-H Content-Type:application/json -H User-Agent:Mozilla/5.0
  -f, --form <FORM>       表单参数,如:-f name=tom -f age=18
  -j, --json <JSON>       json参数,如:-j '{"name": "tom", "age": "18"}'
  -n, --num <REQUESTS>    请求数 [default: 10]
  -t, --thread <THREADS>  并发数 [default: 10]
  -o <OUTPUT>             将请求结果输出到文件 [default: output.txt]
  -h, --help              Print help
  -V, --version           Print version

指定参数

pm -n 10000 -t 50 -f name=sjt -f isMale=true -m POST http://localhost:8080/form

通过配置文件压测

文件类型支持:yml、yaml、toml、json等

pm -c config.toml

文件内容

# config.toml

# 接口路径, 必须
url = "http://localhost:8080/form"
# 请求方法,默认 GET
method = "POST"
# 请求数量,默认 10
num = 10000
# 并发数,默认 10
thread = 50
# 请求结果输出的文件路径,默认,默认 output.txt
output = "output.txt"

# 请求头
[header]
token = "abcd"
system = "sys"

# 表单参数, 与json参数不能同时指定
[form]
name = "sjt"
isMale = true

# json参数, 与表单参数不能同时指定
[json]
name = "sjt"
isMale = true
# 或者
# json = '{"name": "sjt", "isMale": true}'
Commit count: 0

cargo fmt