mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-04 23:16:57 +08:00
feat: testcase config get variables by call function
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user