mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
feat: testcase config get variables by call function
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
config:
|
||||
name: "request methods testcase with variables"
|
||||
variables:
|
||||
foo1: session_bar1
|
||||
variables: ${get_variables()}
|
||||
base_url: "https://postman-echo.com"
|
||||
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)
|
||||
|
||||
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
|
||||
data = {
|
||||
"testcase_path": testcase_path,
|
||||
|
||||
Reference in New Issue
Block a user