diff --git a/examples/demo.json b/examples/demo.json new file mode 100644 index 00000000..cf3f61b7 --- /dev/null +++ b/examples/demo.json @@ -0,0 +1,99 @@ +{ + "config": { + "name": "demo with complex mechanisms", + "base_url": "https://postman-echo.com", + "variables": { + "a": 12.3, + "b": 3.45, + "n": 5, + "varFoo1": "${gen_random_string($n)}", + "varFoo2": "${max($a, $b)}" + } + }, + "teststeps": [ + { + "name": "get with params", + "request": { + "method": "GET", + "url": "/get", + "params": { + "foo1": "$varFoo1", + "foo2": "$varFoo2" + }, + "headers": { + "User-Agent": "HttpBoomer" + } + }, + "variables": { + "b": 34.5, + "n": 3, + "varFoo2": "${max($a, $b)}" + }, + "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": "post json data", + "request": { + "method": "POST", + "url": "/post", + "json": { + "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" + } + ] + } + ] +} \ No newline at end of file diff --git a/examples/demo.yaml b/examples/demo.yaml new file mode 100644 index 00000000..c5c01b44 --- /dev/null +++ b/examples/demo.yaml @@ -0,0 +1,65 @@ +config: + name: demo with complex mechanisms + base_url: https://postman-echo.com + variables: + a: 12.3 + b: 3.45 + "n": 5 + varFoo1: ${gen_random_string($n)} + varFoo2: ${max($a, $b)} +teststeps: + - name: get with params + request: + method: GET + url: /get + params: + foo1: $varFoo1 + foo2: $varFoo2 + headers: + User-Agent: HttpBoomer + variables: + b: 34.5 + "n": 3 + varFoo2: ${max($a, $b)} + 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: post json data + request: + method: POST + url: /post + json: + 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