From 5b964f28680fab0a2eeadb4879f20982cf76f6aa Mon Sep 17 00:00:00 2001 From: debugtalk Date: Fri, 4 Mar 2022 21:04:08 +0800 Subject: [PATCH] change: update tests --- examples/demo.json | 348 +++++++++++++++++----------------- examples/rendezvous_test.json | 208 ++++++++++---------- 2 files changed, 278 insertions(+), 278 deletions(-) diff --git a/examples/demo.json b/examples/demo.json index da332faf..1bb63ed8 100644 --- a/examples/demo.json +++ b/examples/demo.json @@ -1,176 +1,176 @@ { - "config": { - "name": "demo with complex mechanisms", - "base_url": "https://postman-echo.com", - "variables": { - "a": "${sum(10, 2.3)}", - "b": 3.45, - "n": "${sum_ints(1, 2, 2)}", - "varFoo1": "${gen_random_string($n)}", - "varFoo2": "${max($a, $b)}" - } - }, - "teststeps": [ - { - "name": "transaction 1 start", - "transaction": { - "name": "tran1", - "type": "start" - } - }, - { - "name": "get with params", - "request": { - "method": "GET", - "url": "/get", - "params": { - "foo1": "$varFoo1", - "foo2": "$varFoo2" - }, - "headers": { - "User-Agent": "HttpRunnerPlus" - } - }, - "variables": { - "b": 34.5, - "n": 3, - "name": "get with params", - "varFoo2": "${max($a, $b)}" - }, - "setup_hooks": [ - "${setup_hook_example($name)}" - ], - "teardown_hooks": [ - "${teardown_hook_example($name)}" - ], - "extract": { - "varFoo1": "body.args.foo1" - }, - "validate": [ - { - "check": "status_code", - "assert": "equals", - "expect": 200, - "msg": "check response status code" - }, - { - "check": "headers.\"Content-Type\"", - "assert": "startswith", - "expect": "application/json" - }, - { - "check": "body.args.foo1", - "assert": "length_equals", - "expect": 5, - "msg": "check args foo1" - }, - { - "check": "$varFoo1", - "assert": "length_equals", - "expect": 5, - "msg": "check args foo1" - }, - { - "check": "body.args.foo2", - "assert": "equals", - "expect": "34.5", - "msg": "check args foo2" - } - ] - }, - { - "name": "transaction 1 end", - "transaction": { - "name": "tran1", - "type": "end" - } - }, - { - "name": "post json data", - "request": { - "method": "POST", - "url": "/post", - "body": { - "foo1": "$varFoo1", - "foo2": "${max($a, $b)}" - } - }, - "validate": [ - { - "check": "status_code", - "assert": "equals", - "expect": 200, - "msg": "check status code" - }, - { - "check": "body.json.foo1", - "assert": "length_equals", - "expect": 5, - "msg": "check args foo1" - }, - { - "check": "body.json.foo2", - "assert": "equals", - "expect": 12.3, - "msg": "check args foo2" - } - ] - }, - { - "name": "post form data", - "request": { - "method": "POST", - "url": "/post", - "headers": { - "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" - }, - "body": { - "foo1": "$varFoo1", - "foo2": "${max($a, $b)}", - "time": "${get_timestamp()}" - } - }, - "extract": { - "varTime": "body.form.time" - }, - "validate": [ - { - "check": "status_code", - "assert": "equals", - "expect": 200, - "msg": "check status code" - }, - { - "check": "body.form.foo1", - "assert": "length_equals", - "expect": 5, - "msg": "check args foo1" - }, - { - "check": "body.form.foo2", - "assert": "equals", - "expect": "12.3", - "msg": "check args foo2" - } - ] - }, - { - "name": "get with timestamp", - "request": { - "method": "GET", - "url": "/get", - "params": { - "time": "$varTime" - } - }, - "validate": [ - { - "check": "body.args.time", - "assert": "length_equals", - "expect": 13, - "msg": "check extracted var timestamp" - } - ] - } - ] + "config": { + "name": "demo with complex mechanisms", + "base_url": "https://postman-echo.com", + "variables": { + "a": "${sum(10, 2.3)}", + "b": 3.45, + "n": "${sum_ints(1, 2, 2)}", + "varFoo1": "${gen_random_string($n)}", + "varFoo2": "${max($a, $b)}" + } + }, + "teststeps": [ + { + "name": "transaction 1 start", + "transaction": { + "name": "tran1", + "type": "start" + } + }, + { + "name": "get with params", + "request": { + "method": "GET", + "url": "/get", + "params": { + "foo1": "$varFoo1", + "foo2": "$varFoo2" + }, + "headers": { + "User-Agent": "HttpRunnerPlus" + } + }, + "variables": { + "b": 34.5, + "n": 3, + "name": "get with params", + "varFoo2": "${max($a, $b)}" + }, + "setup_hooks": [ + "${setup_hook_example($name)}" + ], + "teardown_hooks": [ + "${teardown_hook_example($name)}" + ], + "extract": { + "varFoo1": "body.args.foo1" + }, + "validate": [ + { + "check": "status_code", + "assert": "equals", + "expect": 200, + "msg": "check response status code" + }, + { + "check": "headers.\"Content-Type\"", + "assert": "startswith", + "expect": "application/json" + }, + { + "check": "body.args.foo1", + "assert": "length_equals", + "expect": 5, + "msg": "check args foo1" + }, + { + "check": "$varFoo1", + "assert": "length_equals", + "expect": 5, + "msg": "check args foo1" + }, + { + "check": "body.args.foo2", + "assert": "equals", + "expect": "34.5", + "msg": "check args foo2" + } + ] + }, + { + "name": "transaction 1 end", + "transaction": { + "name": "tran1", + "type": "end" + } + }, + { + "name": "post json data", + "request": { + "method": "POST", + "url": "/post", + "body": { + "foo1": "$varFoo1", + "foo2": "${max($a, $b)}" + } + }, + "validate": [ + { + "check": "status_code", + "assert": "equals", + "expect": 200, + "msg": "check status code" + }, + { + "check": "body.json.foo1", + "assert": "length_equals", + "expect": 5, + "msg": "check args foo1" + }, + { + "check": "body.json.foo2", + "assert": "equals", + "expect": 12.3, + "msg": "check args foo2" + } + ] + }, + { + "name": "post form data", + "request": { + "method": "POST", + "url": "/post", + "headers": { + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" + }, + "body": { + "foo1": "$varFoo1", + "foo2": "${max($a, $b)}", + "time": "${get_timestamp()}" + } + }, + "extract": { + "varTime": "body.form.time" + }, + "validate": [ + { + "check": "status_code", + "assert": "equals", + "expect": 200, + "msg": "check status code" + }, + { + "check": "body.form.foo1", + "assert": "length_equals", + "expect": 5, + "msg": "check args foo1" + }, + { + "check": "body.form.foo2", + "assert": "equals", + "expect": "12.3", + "msg": "check args foo2" + } + ] + }, + { + "name": "get with timestamp", + "request": { + "method": "GET", + "url": "/get", + "params": { + "time": "$varTime" + } + }, + "validate": [ + { + "check": "body.args.time", + "assert": "length_equals", + "expect": 13, + "msg": "check extracted var timestamp" + } + ] + } + ] } \ No newline at end of file diff --git a/examples/rendezvous_test.json b/examples/rendezvous_test.json index e18ab101..278c4b80 100644 --- a/examples/rendezvous_test.json +++ b/examples/rendezvous_test.json @@ -1,106 +1,106 @@ { - "config": { - "name": "run request with functions", - "base_url": "https://postman-echo.com", - "variables": { - "a": 12.3, - "b": 3.45, - "n": 5 - }, - "parameters_setting": { - "strategy": "Sequential", - "parameterIterator": [ - {} - ] - } - }, - "teststeps": [ - { - "name": "waiting for all users in the beginning", - "rendezvous": { - "name": "rendezvous0" - } - }, - { - "name": "rendezvous before get", - "rendezvous": { - "name": "rendezvous1", - "number": 50, - "timeout": 3000 - } - }, - { - "name": "get with params", - "request": { - "method": "GET", - "url": "/get", - "params": { - "foo1": "foo1", - "foo2": "foo2" - }, - "headers": { - "User-Agent": "HttpRunnerPlus" - } - }, - "extract": { - "varFoo1": "body.args.foo1" - }, - "validate": [ - { - "check": "status_code", - "assert": "equals", - "expect": 200, - "msg": "check status code" - } - ] - }, - { - "name": "rendezvous before post", - "rendezvous": { - "name": "rendezvous2", - "number": 20, - "timeout": 2000 - } - }, - { - "name": "post json data with functions", - "request": { - "method": "POST", - "url": "/post", - "headers": { - "User-Agent": "HttpRunnerPlus" - }, - "body": { - "foo1": "foo1", - "foo2": "foo2" - } - }, - "validate": [ - { - "check": "status_code", - "assert": "equals", - "expect": 200, - "msg": "check status code" - }, - { - "check": "body.json.foo1", - "assert": "length_equals", - "expect": 4, - "msg": "check args foo1" - }, - { - "check": "body.json.foo2", - "assert": "equals", - "expect": "foo2", - "msg": "check args foo2" - } - ] - }, - { - "name": "waiting for all users in the end", - "rendezvous": { - "name": "rendezvous3" - } - } - ] + "config": { + "name": "run request with functions", + "base_url": "https://postman-echo.com", + "variables": { + "a": 12.3, + "b": 3.45, + "n": 5 + }, + "parameters_setting": { + "strategy": "Sequential", + "parameterIterator": [ + {} + ] + } + }, + "teststeps": [ + { + "name": "waiting for all users in the beginning", + "rendezvous": { + "name": "rendezvous0" + } + }, + { + "name": "rendezvous before get", + "rendezvous": { + "name": "rendezvous1", + "number": 50, + "timeout": 3000 + } + }, + { + "name": "get with params", + "request": { + "method": "GET", + "url": "/get", + "params": { + "foo1": "foo1", + "foo2": "foo2" + }, + "headers": { + "User-Agent": "HttpRunnerPlus" + } + }, + "extract": { + "varFoo1": "body.args.foo1" + }, + "validate": [ + { + "check": "status_code", + "assert": "equals", + "expect": 200, + "msg": "check status code" + } + ] + }, + { + "name": "rendezvous before post", + "rendezvous": { + "name": "rendezvous2", + "number": 20, + "timeout": 2000 + } + }, + { + "name": "post json data with functions", + "request": { + "method": "POST", + "url": "/post", + "headers": { + "User-Agent": "HttpRunnerPlus" + }, + "body": { + "foo1": "foo1", + "foo2": "foo2" + } + }, + "validate": [ + { + "check": "status_code", + "assert": "equals", + "expect": 200, + "msg": "check status code" + }, + { + "check": "body.json.foo1", + "assert": "length_equals", + "expect": 4, + "msg": "check args foo1" + }, + { + "check": "body.json.foo2", + "assert": "equals", + "expect": "foo2", + "msg": "check args foo2" + } + ] + }, + { + "name": "waiting for all users in the end", + "rendezvous": { + "name": "rendezvous3" + } + } + ] } \ No newline at end of file