This commit is contained in:
debugtalk
2018-06-29 12:09:52 +08:00
3 changed files with 8 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ def gen_locustfile(testcase_file_path):
"templates",
"locustfile_template"
)
TestcaseLoader.load_test_dependencies()
testset = TestcaseLoader.load_test_file(testcase_file_path)
host = testset.get("config", {}).get("request", {}).get("base_url", "")

View File

@@ -6,6 +6,7 @@ import re
from httprunner import exception, logger, testcase, utils
from httprunner.compat import OrderedDict, basestring
from requests.structures import CaseInsensitiveDict
from requests.models import PreparedRequest
text_extractor_regexp_compile = re.compile(r".*\(.*\).*")
@@ -95,7 +96,11 @@ class ResponseObject(object):
# TODO: remove compatibility for content, text
if isinstance(top_query_content, bytes):
top_query_content = top_query_content.decode("utf-8")
top_query_content = json.loads(top_query_content)
if isinstance(top_query_content, PreparedRequest):
top_query_content = top_query_content.__dict__
else:
top_query_content = json.loads(top_query_content)
except json.decoder.JSONDecodeError:
err_msg = u"Failed to extract data with delimiter!\n"
err_msg += u"response content: {}\n".format(self.content)

View File

@@ -178,7 +178,7 @@ class Runner(object):
extractors = testcase_dict.get("extract", []) or testcase_dict.get("extractors", [])
extracted_variables_mapping = resp_obj.extract_response(extractors)
self.context.bind_extracted_variables(extracted_variables_mapping)
# validate
validators = testcase_dict.get("validate", []) or testcase_dict.get("validators", [])
try: