fix: load_testcase

This commit is contained in:
debugtalk
2020-06-03 22:07:29 +08:00
parent 1f493a1ce4
commit 7e1e69fb1c
9 changed files with 9 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/request_with_functions.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/request_with_testcase_reference.yml
import os

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/hardcode.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/request_with_functions.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/request_with_testcase_reference.yml
import os

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/request_with_variables.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/validate_with_functions.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -1,4 +1,4 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# NOTICE: Generated By HttpRunner.
# FROM: examples/postman_echo/request_methods/validate_with_variables.yml
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase

View File

@@ -73,12 +73,11 @@ def load_test_file(test_file: Text) -> Dict:
def load_testcase(testcase: Dict) -> TestCase:
path = testcase["config"]["path"]
try:
# validate with pydantic TestCase model
testcase_obj = TestCase.parse_obj(testcase)
except ValidationError as ex:
err_msg = f"TestCase ValidationError:\nfile: {path}\nerror: {ex}"
err_msg = f"TestCase ValidationError:\nerror: {ex}\ncontent: {testcase}"
logger.error(err_msg)
raise exceptions.TestCaseFormatError(err_msg)