mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: run testcases by folder path
This commit is contained in:
@@ -65,10 +65,7 @@ def main_ate():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
task_suite = TaskSuite(testset_path)
|
task_suite = TaskSuite(testset_path)
|
||||||
except exception.FileFormatError:
|
except exception.TestcaseNotFound:
|
||||||
success = False
|
|
||||||
continue
|
|
||||||
except exception.FileNotFoundError:
|
|
||||||
success = False
|
success = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -29,14 +29,20 @@ class ParseResponseError(MyBaseError):
|
|||||||
class ValidationError(MyBaseError):
|
class ValidationError(MyBaseError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class FunctionNotFound(NameError):
|
class NotFoundError(MyBaseError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class VariableNotFound(NameError):
|
class FunctionNotFound(NotFoundError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class ApiNotFound(NameError):
|
class VariableNotFound(NotFoundError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class SuiteNotFound(NameError):
|
class ApiNotFound(NotFoundError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class SuiteNotFound(NotFoundError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class TestcaseNotFound(NotFoundError):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TaskSuite(unittest.TestSuite):
|
|||||||
self.suite_list = []
|
self.suite_list = []
|
||||||
testsets = testcase.load_testcases_by_path(testcase_path)
|
testsets = testcase.load_testcases_by_path(testcase_path)
|
||||||
if not testsets:
|
if not testsets:
|
||||||
raise exception.FileNotFoundError
|
raise exception.TestcaseNotFound
|
||||||
|
|
||||||
for testset in testsets:
|
for testset in testsets:
|
||||||
suite = ApiTestSuite(testset)
|
suite = ApiTestSuite(testset)
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ def _load_file(testcase_file_path):
|
|||||||
return _load_yaml_file(testcase_file_path)
|
return _load_yaml_file(testcase_file_path)
|
||||||
else:
|
else:
|
||||||
# '' or other suffix
|
# '' or other suffix
|
||||||
|
err_msg = "file is not in YAML/JSON format: {}".format(testcase_file_path)
|
||||||
|
logging.warning(err_msg)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def extract_variables(content):
|
def extract_variables(content):
|
||||||
@@ -194,10 +196,13 @@ def load_testcases_by_path(path):
|
|||||||
testcases_list = load_testcases_by_path(files_list)
|
testcases_list = load_testcases_by_path(files_list)
|
||||||
|
|
||||||
elif os.path.isfile(path):
|
elif os.path.isfile(path):
|
||||||
testset = load_test_file(path)
|
try:
|
||||||
if testset["testcases"] or testset["api"]:
|
testset = load_test_file(path)
|
||||||
testcases_list = [testset]
|
if testset["testcases"] or testset["api"]:
|
||||||
else:
|
testcases_list = [testset]
|
||||||
|
else:
|
||||||
|
testcases_list = []
|
||||||
|
except exception.FileFormatError:
|
||||||
testcases_list = []
|
testcases_list = []
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user