mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-07 08:49:37 +08:00
fix: run api folder, each api should be encapsulated as individual testcase
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user