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:
debugtalk
2017-07-01 21:40:46 +08:00
parent da445df78b
commit dc7a4b69bc
6 changed files with 164 additions and 117 deletions

View File

@@ -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

View File

@@ -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: