bugfix #210: SuiteNotFound

This commit is contained in:
debugtalk
2018-05-04 19:43:23 +08:00
parent 1164fab267
commit cb57e4bec2
5 changed files with 12 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
__title__ = 'HttpRunner'
__description__ = 'One-stop solution for HTTP(S) testing.'
__url__ = 'https://github.com/HttpRunner/HttpRunner'
__version__ = '1.4.0'
__version__ = '1.4.1'
__author__ = 'debugtalk'
__author_email__ = 'mail@debugtalk.com'
__license__ = 'MIT'

View File

@@ -6,7 +6,6 @@ from httprunner import exception, logger, response, utils
from httprunner.client import HttpSession
from httprunner.context import Context
from httprunner.events import EventHook
from httprunner.testcase import TestcaseLoader
class Runner(object):
@@ -14,7 +13,6 @@ class Runner(object):
def __init__(self, config_dict=None, http_client_session=None):
self.http_client_session = http_client_session
self.context = Context()
TestcaseLoader.load_test_dependencies()
config_dict = config_dict or {}
self.init_config(config_dict, "testset")

View File

@@ -196,6 +196,7 @@ def init_task_suite(path_or_testsets, mapping=None, http_client_session=None):
""" initialize task suite
"""
if not testcase.is_testsets(path_or_testsets):
TestcaseLoader.load_test_dependencies()
testsets = TestcaseLoader.load_testsets_by_path(path_or_testsets)
else:
testsets = path_or_testsets

View File

@@ -20,6 +20,9 @@
- app_version: '2.8.6'
extract:
- token: content.token
validate:
- eq: ["status_code", 200]
- len_eq: ["content.token", 16]
- test:
name: reset all users

View File

@@ -145,3 +145,10 @@ class TestHttpRunner(ApiServerUnittest):
self.assertTrue(os.path.isfile(report))
report_save_dir = os.path.join(os.getcwd(), 'reports', output_folder_name)
shutil.rmtree(report_save_dir)
def test_testcase_layer(self):
testcase_path = "tests/testcases/smoketest.yml"
runner = HttpRunner(failfast=True).run(testcase_path)
summary = runner.summary
self.assertTrue(summary["success"])
self.assertEqual(summary["stat"]["testsRun"], 8)