mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
19
HISTORY.md
Normal file
19
HISTORY.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Release History
|
||||
|
||||
## 2.0.1 (2019.01.18)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
- override current teststep variables with former testcase output variables;
|
||||
- make compatible with testcase name is empty;
|
||||
- skip undefined variable when parsing string content;
|
||||
- add request method in report.
|
||||
|
||||
## 2.0.0 (2019.01.01)
|
||||
|
||||
- Massive Refactor and Simplification
|
||||
- Redesign testcase structure
|
||||
- Module pipline
|
||||
- Start Semantic Versioning
|
||||
- Switch to Apache 2.0 license
|
||||
- Change logo
|
||||
@@ -1,7 +1,7 @@
|
||||
__title__ = 'HttpRunner'
|
||||
__description__ = 'One-stop solution for HTTP(S) testing.'
|
||||
__url__ = 'https://github.com/HttpRunner/HttpRunner'
|
||||
__version__ = '2.0.0'
|
||||
__version__ = '2.0.1'
|
||||
__author__ = 'debugtalk'
|
||||
__author_email__ = 'mail@debugtalk.com'
|
||||
__license__ = 'Apache-2.0'
|
||||
|
||||
@@ -82,6 +82,7 @@ class HttpSession(requests.Session):
|
||||
|
||||
# record actual request info
|
||||
req_resp_dict["request"]["url"] = resp_obj.request.url
|
||||
req_resp_dict["request"]["method"] = resp_obj.request.method
|
||||
req_resp_dict["request"]["headers"] = dict(resp_obj.request.headers)
|
||||
|
||||
request_body = resp_obj.request.body
|
||||
|
||||
@@ -503,7 +503,8 @@ def parse_string_variables(content, variables_mapping, functions_mapping):
|
||||
parsed_variable_value = parse_data(
|
||||
variable_value,
|
||||
variables_mapping,
|
||||
functions_mapping
|
||||
functions_mapping,
|
||||
raise_if_variable_not_found=False
|
||||
)
|
||||
|
||||
# TODO: replace variable label from $var to {{var}}
|
||||
@@ -733,8 +734,12 @@ def _extend_with_testcase(test_dict, testcase_def_dict):
|
||||
test_verify = test_dict.pop("verify", True)
|
||||
testcase_def_dict["config"].setdefault("verify", test_verify)
|
||||
|
||||
# override name
|
||||
test_name = test_dict.pop("name") or testcase_def_dict["config"].pop("name") or "Undefined name"
|
||||
|
||||
# override testcase config name, output, etc.
|
||||
testcase_def_dict["config"].update(test_dict)
|
||||
testcase_def_dict["config"]["name"] = test_name
|
||||
|
||||
test_dict.clear()
|
||||
test_dict.update(testcase_def_dict)
|
||||
|
||||
@@ -291,6 +291,13 @@ class Runner(object):
|
||||
tests = testcase_dict.get("teststeps", [])
|
||||
|
||||
for index, test_dict in enumerate(tests):
|
||||
|
||||
# override current teststep variables with former testcase output variables
|
||||
former_output_variables = self.session_context.test_variables_mapping
|
||||
if former_output_variables:
|
||||
test_dict.setdefault("variables", {})
|
||||
test_dict["variables"].update(former_output_variables)
|
||||
|
||||
try:
|
||||
test_runner.run_test(test_dict)
|
||||
except Exception:
|
||||
|
||||
@@ -348,13 +348,13 @@ class TestParser(unittest.TestCase):
|
||||
def test_substitute_variables(self):
|
||||
content = {
|
||||
'request': {
|
||||
'url': '/api/users/$uid',
|
||||
'url': '/api/users/$uid?id=$id',
|
||||
'headers': {'token': '$token'}
|
||||
}
|
||||
}
|
||||
variables_mapping = {"$uid": 1000}
|
||||
variables_mapping = {"$uid": 1000, "$id": 2}
|
||||
substituted_data = parser.substitute_variables(content, variables_mapping)
|
||||
self.assertEqual(substituted_data["request"]["url"], "/api/users/1000")
|
||||
self.assertEqual(substituted_data["request"]["url"], "/api/users/1000?id=2")
|
||||
self.assertEqual(substituted_data["request"]["headers"], {'token': '$token'})
|
||||
|
||||
def test_parse_parameters_raw_list(self):
|
||||
@@ -700,7 +700,7 @@ class TestParser(unittest.TestCase):
|
||||
self.assertEqual(test_dict["variables"]["num4"], "${sum_two($num0, 5)}")
|
||||
self.assertEqual(
|
||||
test_dict["request"]["url"],
|
||||
"https://httprunner.org/api1/?num1=$num1&num2=$num2&num3=$num3&num4=$num4"
|
||||
"https://httprunner.org/api1/?num1=3&num2=6&num3=10&num4=${sum_two($num0, 5)}"
|
||||
)
|
||||
|
||||
def test_parse_tests_base_url_teststep_empty(self):
|
||||
|
||||
Reference in New Issue
Block a user