feat: testcase config get variables by call function

This commit is contained in:
debugtalk
2020-05-18 22:49:58 +08:00
parent 7ebb1696c7
commit 9dcf54a5a6
2 changed files with 10 additions and 2 deletions
@@ -1,7 +1,6 @@
config: config:
name: "request methods testcase with variables" name: "request methods testcase with variables"
variables: variables: ${get_variables()}
foo1: session_bar1
base_url: "https://postman-echo.com" base_url: "https://postman-echo.com"
verify: False verify: False
+9
View File
@@ -84,6 +84,15 @@ def make_testcase(testcase: Dict) -> Union[str, None]:
testcase_python_path, name_in_title_case = convert_testcase_path(testcase_path) testcase_python_path, name_in_title_case = convert_testcase_path(testcase_path)
config = testcase["config"] config = testcase["config"]
config.setdefault("variables", {})
if isinstance(config["variables"], Text):
# get variables by function, e.g. ${get_variables()}
project_meta = load_project_meta(testcase_path)
config["variables"] = parse_data(
config["variables"], {}, project_meta.functions
)
config["path"] = testcase_python_path config["path"] = testcase_python_path
data = { data = {
"testcase_path": testcase_path, "testcase_path": testcase_path,