mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: load_testcase
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user