mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
138 lines
3.8 KiB
JSON
138 lines
3.8 KiB
JSON
{
|
|
"config": {
|
|
"name": "request methods testcase with functions",
|
|
"variables": {
|
|
"foo1": "config_bar1",
|
|
"foo2": "config_bar2",
|
|
"expect_foo1": "config_bar1",
|
|
"expect_foo2": "config_bar2"
|
|
},
|
|
"base_url": "https://postman-echo.com",
|
|
"verify": false,
|
|
"export": [
|
|
"foo3"
|
|
]
|
|
},
|
|
"teststeps": [
|
|
{
|
|
"name": "get with params",
|
|
"variables": {
|
|
"foo1": "${ENV(USERNAME)}",
|
|
"foo2": "bar21",
|
|
"sum_v": "${sum_two_int(1, 2)}"
|
|
},
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "/get",
|
|
"params": {
|
|
"foo1": "$foo1",
|
|
"foo2": "$foo2",
|
|
"sum_v": "$sum_v"
|
|
},
|
|
"headers": {
|
|
"User-Agent": "funplugin/${get_version()}"
|
|
}
|
|
},
|
|
"extract": {
|
|
"foo3": "body.args.foo2"
|
|
},
|
|
"validate": [
|
|
{
|
|
"eq": [
|
|
"status_code",
|
|
200
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.args.foo1",
|
|
"debugtalk"
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.args.sum_v",
|
|
"3"
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.args.foo2",
|
|
"bar21"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "post raw text",
|
|
"variables": {
|
|
"foo1": "bar12",
|
|
"foo3": "bar32"
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/post",
|
|
"headers": {
|
|
"User-Agent": "funplugin/${get_version()}",
|
|
"Content-Type": "text/plain"
|
|
},
|
|
"data": "This is expected to be sent back as part of response body: $foo1-$foo2-$foo3."
|
|
},
|
|
"validate": [
|
|
{
|
|
"eq": [
|
|
"status_code",
|
|
200
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.data",
|
|
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar32."
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "post form data",
|
|
"variables": {
|
|
"foo2": "bar23"
|
|
},
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "/post",
|
|
"headers": {
|
|
"User-Agent": "funplugin/${get_version()}",
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
},
|
|
"data": "foo1=$foo1&foo2=$foo2&foo3=$foo3"
|
|
},
|
|
"validate": [
|
|
{
|
|
"eq": [
|
|
"status_code",
|
|
200
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.form.foo1",
|
|
"$expect_foo1"
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.form.foo2",
|
|
"bar23"
|
|
]
|
|
},
|
|
{
|
|
"eq": [
|
|
"body.form.foo3",
|
|
"bar21"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |