mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-21 16:23:16 +08:00
TestcaseParser: add update_variables_binds
This commit is contained in:
@@ -6,7 +6,13 @@ class TestcaseParser(object):
|
||||
def __init__(self, variables_binds={}):
|
||||
self.variables_binds = variables_binds
|
||||
|
||||
def parse(self, testcase_template, variables_binds={}):
|
||||
def update_variables_binds(self, variables_mapping):
|
||||
""" update variables binds with new mapping.
|
||||
"""
|
||||
if variables_mapping:
|
||||
self.variables_binds.update(variables_mapping)
|
||||
|
||||
def parse(self, testcase_template):
|
||||
""" parse testcase_template, replace all variables with bind value.
|
||||
variables marker: ${variable}.
|
||||
@param testcase_template
|
||||
@@ -30,12 +36,7 @@ class TestcaseParser(object):
|
||||
"msg": "user created successfully."
|
||||
}
|
||||
}
|
||||
@param variables_binds
|
||||
variable binds of testcase parser instance will be updated.
|
||||
"""
|
||||
if variables_binds:
|
||||
self.variables_binds.update(variables_binds)
|
||||
|
||||
return self.substitute(testcase_template)
|
||||
|
||||
def substitute(self, content):
|
||||
|
||||
Reference in New Issue
Block a user