Releases: bbxwinner/httprunner
Releases · bbxwinner/httprunner
v4.3.6
v4.3.3.2306151200
active IgnoreNotFoundError option for tap_cv
v4.3.2-fix-adb
fix: err wrap and TapFloat
v4.2.0
v4.2.0-dial
Main Changes
支持数字体验监测——网络拨测的基础能力:ping / dns解析 / traceroute
v4.1.6-dial-test
Main Changes
- feat: support run ping and save results
Usage:
hrp ping $url [flags]
Flags:
-c, --count int Stop after sending (and receiving) N packets (default 10)
-h, --help help for ping
-i, --interval duration Wait N seconds between sending each packet (default 1s)
--save-tests Save ping results json
-t, --timeout duration Ping exits after N seconds (default 20s)
Global Flags:
--log-json set log to json format
-l, --log-level string set log level (default "INFO")
--venv string specify python3 venv path
v4.1.7-fix-upload-file
新特性
上传文件时支持指定 MIME 类型和文件名称
使用方式
在用于上传文件的 upload 字段中,当且仅当 map 的值以 @ 开头,例如 @"FILEPATH" 或 @FILEPATH 的形式时,程序会尝试加载 FILEPATH 所指向的文件,并以 form-data 的形式上传。另外,支持在文件路径的后面增加filename=xxx和type=xxx选项用于配置 MIME 头域信息,选项和文件路径之间用分号 ‘;‘ 分隔开。
如果 map 值不为文件路径而是普通文本时,程序会自动去除文本最外层包裹的双引号,例如传递的文本为 "@DUMMYPATH" 时,实际传递给服务端的是 @DUMMYPATH
注意
当 map 值为普通文本时,filename 和 type 选项依然会生效。
下面给出一个完整的测试用例:
{
"config": {
"name": "test upload file to httpbin",
"base_url": "http://httpbin.org",
"variables": {
"upload_file": "test.env"
}
},
"teststeps": [
{
"name": "upload field string with filename and type",
"request": {
"method": "POST",
"url": "/post",
"headers": {
"Content-Type": "${multipart_content_type($m_encoder)}"
},
"body": "$m_encoder",
"upload": {
"foo1": "bar1",
"foo2": "@\"$upload_file\";filename=newBar2;type=text/plain"
}
},
"validate": [
{
"check": "status_code",
"assert": "equals",
"expect": 200,
"msg": "check status code"
},
{
"check": "body.form.foo1",
"assert": "startswith",
"expect": "bar1",
"msg": "check foo1 in form"
},
{
"check": "body.files.foo2",
"assert": "startswith",
"expect": "UserName=test",
"msg": "check foo2 in files"
}
]
}
]
}
抓包自测
使用 hrp 运行上面的测试用例,并使用 wireshark 的抓包结果如下:
v4.1.7-fix-ws
v4.1.7 (2022-07-11)
go version
- feat: support omitting websocket url if not necessary
- feat: support multiple websocket connections each session
- fix: optimize websocket step initialization
