refactor: use step export to export session variables from referenced testcase

This commit is contained in:
debugtalk
2020-06-05 11:31:51 +08:00
parent 528ddd0c67
commit adf0967888
7 changed files with 39 additions and 35 deletions

View File

@@ -133,10 +133,10 @@ def ensure_step_attachment(step: Dict) -> Dict:
test_dict["teardown_hooks"] = step["teardown_hooks"]
if "extract" in step:
if step.get("request"):
test_dict["extract"] = convert_extractors(step["extract"])
elif step.get("testcase"):
test_dict["extract"] = step["extract"]
test_dict["extract"] = convert_extractors(step["extract"])
if "export" in step:
test_dict["export"] = step["export"]
if "validate" in step:
test_dict["validate"] = convert_validators(step["validate"])
@@ -167,8 +167,6 @@ def ensure_testcase_v3(test_content: Dict) -> Dict:
for step in test_content["teststeps"]:
teststep = {}
teststep.update(ensure_step_attachment(step))
if "request" in step:
teststep["request"] = step.pop("request")
elif "api" in step:
@@ -176,6 +174,8 @@ def ensure_testcase_v3(test_content: Dict) -> Dict:
elif "testcase" in step:
teststep["testcase"] = step.pop("testcase")
teststep.update(ensure_step_attachment(step))
teststep = sort_step_by_custom_order(teststep)
v3_content["teststeps"].append(teststep)