change: update tests

This commit is contained in:
debugtalk
2022-03-04 21:04:08 +08:00
parent 37355ab58e
commit 1904d404fd
2 changed files with 278 additions and 278 deletions

View File

@@ -1,176 +1,176 @@
{ {
"config": { "config": {
"name": "demo with complex mechanisms", "name": "demo with complex mechanisms",
"base_url": "https://postman-echo.com", "base_url": "https://postman-echo.com",
"variables": { "variables": {
"a": "${sum(10, 2.3)}", "a": "${sum(10, 2.3)}",
"b": 3.45, "b": 3.45,
"n": "${sum_ints(1, 2, 2)}", "n": "${sum_ints(1, 2, 2)}",
"varFoo1": "${gen_random_string($n)}", "varFoo1": "${gen_random_string($n)}",
"varFoo2": "${max($a, $b)}" "varFoo2": "${max($a, $b)}"
} }
}, },
"teststeps": [ "teststeps": [
{ {
"name": "transaction 1 start", "name": "transaction 1 start",
"transaction": { "transaction": {
"name": "tran1", "name": "tran1",
"type": "start" "type": "start"
} }
}, },
{ {
"name": "get with params", "name": "get with params",
"request": { "request": {
"method": "GET", "method": "GET",
"url": "/get", "url": "/get",
"params": { "params": {
"foo1": "$varFoo1", "foo1": "$varFoo1",
"foo2": "$varFoo2" "foo2": "$varFoo2"
}, },
"headers": { "headers": {
"User-Agent": "HttpRunnerPlus" "User-Agent": "HttpRunnerPlus"
} }
}, },
"variables": { "variables": {
"b": 34.5, "b": 34.5,
"n": 3, "n": 3,
"name": "get with params", "name": "get with params",
"varFoo2": "${max($a, $b)}" "varFoo2": "${max($a, $b)}"
}, },
"setup_hooks": [ "setup_hooks": [
"${setup_hook_example($name)}" "${setup_hook_example($name)}"
], ],
"teardown_hooks": [ "teardown_hooks": [
"${teardown_hook_example($name)}" "${teardown_hook_example($name)}"
], ],
"extract": { "extract": {
"varFoo1": "body.args.foo1" "varFoo1": "body.args.foo1"
}, },
"validate": [ "validate": [
{ {
"check": "status_code", "check": "status_code",
"assert": "equals", "assert": "equals",
"expect": 200, "expect": 200,
"msg": "check response status code" "msg": "check response status code"
}, },
{ {
"check": "headers.\"Content-Type\"", "check": "headers.\"Content-Type\"",
"assert": "startswith", "assert": "startswith",
"expect": "application/json" "expect": "application/json"
}, },
{ {
"check": "body.args.foo1", "check": "body.args.foo1",
"assert": "length_equals", "assert": "length_equals",
"expect": 5, "expect": 5,
"msg": "check args foo1" "msg": "check args foo1"
}, },
{ {
"check": "$varFoo1", "check": "$varFoo1",
"assert": "length_equals", "assert": "length_equals",
"expect": 5, "expect": 5,
"msg": "check args foo1" "msg": "check args foo1"
}, },
{ {
"check": "body.args.foo2", "check": "body.args.foo2",
"assert": "equals", "assert": "equals",
"expect": "34.5", "expect": "34.5",
"msg": "check args foo2" "msg": "check args foo2"
} }
] ]
}, },
{ {
"name": "transaction 1 end", "name": "transaction 1 end",
"transaction": { "transaction": {
"name": "tran1", "name": "tran1",
"type": "end" "type": "end"
} }
}, },
{ {
"name": "post json data", "name": "post json data",
"request": { "request": {
"method": "POST", "method": "POST",
"url": "/post", "url": "/post",
"body": { "body": {
"foo1": "$varFoo1", "foo1": "$varFoo1",
"foo2": "${max($a, $b)}" "foo2": "${max($a, $b)}"
} }
}, },
"validate": [ "validate": [
{ {
"check": "status_code", "check": "status_code",
"assert": "equals", "assert": "equals",
"expect": 200, "expect": 200,
"msg": "check status code" "msg": "check status code"
}, },
{ {
"check": "body.json.foo1", "check": "body.json.foo1",
"assert": "length_equals", "assert": "length_equals",
"expect": 5, "expect": 5,
"msg": "check args foo1" "msg": "check args foo1"
}, },
{ {
"check": "body.json.foo2", "check": "body.json.foo2",
"assert": "equals", "assert": "equals",
"expect": 12.3, "expect": 12.3,
"msg": "check args foo2" "msg": "check args foo2"
} }
] ]
}, },
{ {
"name": "post form data", "name": "post form data",
"request": { "request": {
"method": "POST", "method": "POST",
"url": "/post", "url": "/post",
"headers": { "headers": {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}, },
"body": { "body": {
"foo1": "$varFoo1", "foo1": "$varFoo1",
"foo2": "${max($a, $b)}", "foo2": "${max($a, $b)}",
"time": "${get_timestamp()}" "time": "${get_timestamp()}"
} }
}, },
"extract": { "extract": {
"varTime": "body.form.time" "varTime": "body.form.time"
}, },
"validate": [ "validate": [
{ {
"check": "status_code", "check": "status_code",
"assert": "equals", "assert": "equals",
"expect": 200, "expect": 200,
"msg": "check status code" "msg": "check status code"
}, },
{ {
"check": "body.form.foo1", "check": "body.form.foo1",
"assert": "length_equals", "assert": "length_equals",
"expect": 5, "expect": 5,
"msg": "check args foo1" "msg": "check args foo1"
}, },
{ {
"check": "body.form.foo2", "check": "body.form.foo2",
"assert": "equals", "assert": "equals",
"expect": "12.3", "expect": "12.3",
"msg": "check args foo2" "msg": "check args foo2"
} }
] ]
}, },
{ {
"name": "get with timestamp", "name": "get with timestamp",
"request": { "request": {
"method": "GET", "method": "GET",
"url": "/get", "url": "/get",
"params": { "params": {
"time": "$varTime" "time": "$varTime"
} }
}, },
"validate": [ "validate": [
{ {
"check": "body.args.time", "check": "body.args.time",
"assert": "length_equals", "assert": "length_equals",
"expect": 13, "expect": 13,
"msg": "check extracted var timestamp" "msg": "check extracted var timestamp"
} }
] ]
} }
] ]
} }

View File

@@ -1,106 +1,106 @@
{ {
"config": { "config": {
"name": "run request with functions", "name": "run request with functions",
"base_url": "https://postman-echo.com", "base_url": "https://postman-echo.com",
"variables": { "variables": {
"a": 12.3, "a": 12.3,
"b": 3.45, "b": 3.45,
"n": 5 "n": 5
}, },
"parameters_setting": { "parameters_setting": {
"strategy": "Sequential", "strategy": "Sequential",
"parameterIterator": [ "parameterIterator": [
{} {}
] ]
} }
}, },
"teststeps": [ "teststeps": [
{ {
"name": "waiting for all users in the beginning", "name": "waiting for all users in the beginning",
"rendezvous": { "rendezvous": {
"name": "rendezvous0" "name": "rendezvous0"
} }
}, },
{ {
"name": "rendezvous before get", "name": "rendezvous before get",
"rendezvous": { "rendezvous": {
"name": "rendezvous1", "name": "rendezvous1",
"number": 50, "number": 50,
"timeout": 3000 "timeout": 3000
} }
}, },
{ {
"name": "get with params", "name": "get with params",
"request": { "request": {
"method": "GET", "method": "GET",
"url": "/get", "url": "/get",
"params": { "params": {
"foo1": "foo1", "foo1": "foo1",
"foo2": "foo2" "foo2": "foo2"
}, },
"headers": { "headers": {
"User-Agent": "HttpRunnerPlus" "User-Agent": "HttpRunnerPlus"
} }
}, },
"extract": { "extract": {
"varFoo1": "body.args.foo1" "varFoo1": "body.args.foo1"
}, },
"validate": [ "validate": [
{ {
"check": "status_code", "check": "status_code",
"assert": "equals", "assert": "equals",
"expect": 200, "expect": 200,
"msg": "check status code" "msg": "check status code"
} }
] ]
}, },
{ {
"name": "rendezvous before post", "name": "rendezvous before post",
"rendezvous": { "rendezvous": {
"name": "rendezvous2", "name": "rendezvous2",
"number": 20, "number": 20,
"timeout": 2000 "timeout": 2000
} }
}, },
{ {
"name": "post json data with functions", "name": "post json data with functions",
"request": { "request": {
"method": "POST", "method": "POST",
"url": "/post", "url": "/post",
"headers": { "headers": {
"User-Agent": "HttpRunnerPlus" "User-Agent": "HttpRunnerPlus"
}, },
"body": { "body": {
"foo1": "foo1", "foo1": "foo1",
"foo2": "foo2" "foo2": "foo2"
} }
}, },
"validate": [ "validate": [
{ {
"check": "status_code", "check": "status_code",
"assert": "equals", "assert": "equals",
"expect": 200, "expect": 200,
"msg": "check status code" "msg": "check status code"
}, },
{ {
"check": "body.json.foo1", "check": "body.json.foo1",
"assert": "length_equals", "assert": "length_equals",
"expect": 4, "expect": 4,
"msg": "check args foo1" "msg": "check args foo1"
}, },
{ {
"check": "body.json.foo2", "check": "body.json.foo2",
"assert": "equals", "assert": "equals",
"expect": "foo2", "expect": "foo2",
"msg": "check args foo2" "msg": "check args foo2"
} }
] ]
}, },
{ {
"name": "waiting for all users in the end", "name": "waiting for all users in the end",
"rendezvous": { "rendezvous": {
"name": "rendezvous3" "name": "rendezvous3"
} }
} }
] ]
} }