mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
Merge branch 'master' into master
This commit is contained in:
@@ -103,8 +103,8 @@ class HttpSession(requests.Session):
|
||||
self.meta_data["request_time"] = time.time()
|
||||
response = self._send_request_safe_mode(method, url, **kwargs)
|
||||
# record the consumed time
|
||||
self.meta_data["response_time(ms)"] = round((time.time() - self.meta_data["request_time"]) * 1000, 2)
|
||||
self.meta_data["elapsed(ms)"] = response.elapsed.microseconds / 1000.0
|
||||
self.meta_data["response_time_ms"] = round((time.time() - self.meta_data["request_time"]) * 1000, 2)
|
||||
self.meta_data["elapsed_ms"] = response.elapsed.microseconds / 1000.0
|
||||
|
||||
self.meta_data["url"] = (response.history and response.history[0] or response)\
|
||||
.request.url
|
||||
@@ -140,7 +140,7 @@ class HttpSession(requests.Session):
|
||||
logger.log_info(
|
||||
"""status_code: {}, response_time(ms): {} ms, response_length: {} bytes""".format(
|
||||
self.meta_data["status_code"],
|
||||
self.meta_data["response_time(ms)"],
|
||||
self.meta_data["response_time_ms"],
|
||||
self.meta_data["content_size"]
|
||||
)
|
||||
)
|
||||
|
||||
@@ -217,6 +217,7 @@ class Context(object):
|
||||
def do_validation(self, validator_dict):
|
||||
""" validate with functions
|
||||
"""
|
||||
# TODO: move comparator uniform to init_task_suite
|
||||
comparator = utils.get_uniform_comparator(validator_dict["comparator"])
|
||||
validate_func = self.testcase_parser.get_bind_function(comparator)
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ class Runner(object):
|
||||
for variable in output_variables_list:
|
||||
if variable not in variables_mapping:
|
||||
logger.log_warning(
|
||||
"variable '{}' can not be found in variables mapping, failed to ouput!"\
|
||||
"variable '{}' can not be found in variables mapping, failed to output!"\
|
||||
.format(variable)
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -202,6 +202,7 @@ def init_task_suite(path_or_testsets, mapping=None, http_client_session=None):
|
||||
else:
|
||||
testsets = path_or_testsets
|
||||
|
||||
# TODO: move comparator uniform here
|
||||
mapping = mapping or {}
|
||||
return TaskSuite(testsets, mapping, http_client_session)
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
<tr id="record_{{loop.index}}">
|
||||
<th class="{{record.status}}" style="width:5em;">{{record.status}}</td>
|
||||
<td>{{record.name}}</td>
|
||||
<td style="text-align:center;width:6em;">{{ record.meta_data["response_time(ms)"] }} ms</td>
|
||||
<td style="text-align:center;width:6em;">{{ record.meta_data["response_time_ms"] }} ms</td>
|
||||
<td class="detail">
|
||||
|
||||
<a class="button" href="#popup_log_{{loop.index}}">log</a>
|
||||
@@ -264,11 +264,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>response_time(ms)</th>
|
||||
<td>{{ record.meta_data["response_time(ms)"] }}</td>
|
||||
<td>{{ record.meta_data["response_time_ms"] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>elapsed(ms)</th>
|
||||
<td>{{ record.meta_data["elapsed(ms)"] }}</td>
|
||||
<td>{{ record.meta_data["elapsed_ms"] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
test-id='{{ loop.index }}'>
|
||||
<div class='test-heading'>
|
||||
<span class='test-name'>{{ record.name }}</span>
|
||||
<span class='test-time'>{{ record.meta_data["response_time(ms)"] }} ms</span>
|
||||
<span class='test-time'>{{ record.meta_data.response_time_ms }} ms</span>
|
||||
<span class='test-status right pass'>pass</span>
|
||||
</div>
|
||||
{% elif record.status == 'error' %}
|
||||
@@ -173,13 +173,13 @@
|
||||
test-id='{{ loop.index }}'>
|
||||
<div class='test-heading'>
|
||||
<span class='test-name'>{{ record.name }}</span>
|
||||
<span class='test-time'>{{ record.meta_data["response_time(ms)"] }} ms</span>
|
||||
<span class='test-time'>{{ record.meta_data.response_time_ms }} ms</span>
|
||||
<span class='test-status right fail'>fail</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class='test-content hide'>
|
||||
<div class='test-time-info'>
|
||||
<span class='label start-time'>{{ record.meta_data["response_time(ms)"] }} ms</span>
|
||||
<span class='label start-time'>{{ record.meta_data.response_time_ms }} ms</span>
|
||||
</div>
|
||||
<div class='test-steps'>
|
||||
<table class='bordered table-results'>
|
||||
|
||||
Reference in New Issue
Block a user