feat: implement step setup/teardown hooks

This commit is contained in:
debugtalk
2020-06-07 16:38:59 +08:00
parent 5cc5e5be28
commit 31f5cfa9df
3 changed files with 67 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ FunctionsMapping = Dict[Text, Callable]
Headers = Dict[Text, Text]
Cookies = Dict[Text, Text]
Verify = bool
Hook = List[Text]
Hooks = Union[List[Text], Dict[Text, Text]]
Export = List[Text]
Validators = List[Dict]
Env = Dict[Text, Any]
@@ -37,8 +37,8 @@ class TConfig(BaseModel):
base_url: BaseUrl = ""
# Text: prepare variables in debugtalk.py, ${gen_variables()}
variables: Union[VariablesMapping, Text] = {}
setup_hooks: Hook = []
teardown_hooks: Hook = []
# setup_hooks: Hooks = []
# teardown_hooks: Hooks = []
export: Export = []
path: Text = None
@@ -64,8 +64,8 @@ class TStep(BaseModel):
request: Union[TRequest, None] = None
testcase: Union[Text, Callable, None] = None
variables: VariablesMapping = {}
setup_hooks: Hook = []
teardown_hooks: Hook = []
setup_hooks: Hooks = []
teardown_hooks: Hooks = []
# used to extract request's response field
extract: VariablesMapping = {}
# used to export session variables from referenced testcase