1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 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" } ] } ] }
|