mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-02 22:39:42 +08:00
change variable marker and function marker:
1, variable marker: ${var} => $var;
2, function marker: {'func': 'gen_random_string', 'args': [5]} => ${gen_random_string(5).
This commit is contained in:
@@ -10,17 +10,17 @@
|
||||
gen_md5: "lambda *str_args: hashlib.md5(''.join(str_args).encode('utf-8')).hexdigest()"
|
||||
variable_binds:
|
||||
- TOKEN: debugtalk
|
||||
- random: {"func": "gen_random_string", "args": [5]}
|
||||
- random: ${gen_random_string(5)}
|
||||
- data: '{"name": "user", "password": "123456"}'
|
||||
- authorization: {"func": "gen_md5", "args": ["${TOKEN}", "${data}", "${random}"]}
|
||||
- authorization: ${gen_md5($TOKEN, $data, $random)}
|
||||
request:
|
||||
url: http://127.0.0.1:5000/api/users/1000
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
authorization: "${authorization}"
|
||||
random: "${random}"
|
||||
data: "${data}"
|
||||
authorization: $authorization
|
||||
random: $random
|
||||
data: $data
|
||||
validators:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 201}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": true}
|
||||
@@ -36,17 +36,17 @@
|
||||
gen_md5: "lambda *str_args: hashlib.md5(''.join(str_args).encode('utf-8')).hexdigest()"
|
||||
variable_binds:
|
||||
- TOKEN: debugtalk
|
||||
- random: {"func": "gen_random_string", "args": [5]}
|
||||
- random: ${gen_random_string(5)}
|
||||
- data: '{"name": "user", "password": "123456"}'
|
||||
- authorization: {"func": "gen_md5", "args": ["${TOKEN}", "${data}", "${random}"]}
|
||||
- authorization: ${gen_md5($TOKEN, $data, $random)}
|
||||
request:
|
||||
url: http://127.0.0.1:5000/api/users/1000
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json
|
||||
authorization: "${authorization}"
|
||||
random: "${random}"
|
||||
data: "${data}"
|
||||
authorization: $authorization
|
||||
random: $random
|
||||
data: $data
|
||||
validators:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 500}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": false}
|
||||
|
||||
Reference in New Issue
Block a user