fix: run api folder, each api should be encapsulated as individual testcase

This commit is contained in:
debugtalk
2018-12-24 12:24:30 +08:00
parent de53da5962
commit 6a68207aa9
5 changed files with 21 additions and 9 deletions

View File

@@ -770,7 +770,7 @@ def load_tests(path, dot_env_path=None):
elif loaded_content["type"] == "testcase":
tests_mapping.setdefault("testcases", []).append(loaded_content)
elif loaded_content["type"] == "api":
tests_mapping.setdefault("api", []).append(loaded_content)
tests_mapping.setdefault("apis", []).append(loaded_content)
if os.path.isdir(path):
files_list = load_folder_files(path)

View File

@@ -1101,12 +1101,13 @@ def parse_tests(tests_mapping):
_parse_testcase(testcase, project_mapping)
parsed_tests_mapping["testcases"].append(testcase)
elif test_type == "api":
elif test_type == "apis":
# encapsulate api as a testcase
testcase = {
"teststeps": tests_mapping["api"]
}
_parse_testcase(testcase, project_mapping)
parsed_tests_mapping["testcases"].append(testcase)
for api_content in tests_mapping["apis"]:
testcase = {
"teststeps": [api_content]
}
_parse_testcase(testcase, project_mapping)
parsed_tests_mapping["testcases"].append(testcase)
return parsed_tests_mapping

View File

@@ -85,7 +85,7 @@ def stringify_summary(summary):
for index, suite_summary in enumerate(summary["details"]):
if not suite_summary.get("name"):
suite_summary["name"] = "test suite {}".format(index)
suite_summary["name"] = "testcase {}".format(index)
for record in suite_summary.get("records"):
meta_datas = record['meta_datas']