mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 06:29:44 +08:00
refactor context:
1, testset and testcase are in different context level; 2, testset context will be initialized when a file is loaded, and testcase level context initializes when each testcase starts; 3, testcase context should inherit from testset context configs, and the testcase context has high priority.
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
-
|
||||
register_variables:
|
||||
variable_binds:
|
||||
- TOKEN: "debugtalk"
|
||||
|
||||
-
|
||||
variable_binds:
|
||||
- var: [1, 2, 3]
|
||||
|
||||
-
|
||||
variable_binds:
|
||||
- data: {'name': 'user', 'password': '123456'}
|
||||
|
||||
-
|
||||
register_template_variables:
|
||||
variable_binds:
|
||||
- TOKEN: "debugtalk"
|
||||
- token: ${TOKEN}
|
||||
|
||||
-
|
||||
bind_lambda_functions:
|
||||
function_binds:
|
||||
add_one: "lambda x: x + 1"
|
||||
add_two_nums: "lambda x, y: x + y"
|
||||
@@ -23,7 +17,7 @@
|
||||
- add1: {"func": "add_one", "args": [2]}
|
||||
- sum2nums: {"func": "add_two_nums", "args": [2, 3]}
|
||||
|
||||
-
|
||||
bind_lambda_functions_with_import:
|
||||
requires:
|
||||
- random
|
||||
- string
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
gen_md5: "lambda *str_args: hashlib.md5(''.join(str_args).encode('utf-8')).hexdigest()"
|
||||
variable_binds:
|
||||
- TOKEN: debugtalk
|
||||
- data: ""
|
||||
- random: {"func": "gen_random_string", "args": [5]}
|
||||
- data: '{"name": "user", "password": "123456"}'
|
||||
- authorization: {"func": "gen_md5", "args": ["${TOKEN}", "${data}", "${random}"]}
|
||||
|
||||
- test:
|
||||
|
||||
Reference in New Issue
Block a user