kuto
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: kuto | ||
| Version: 0.0.72 | ||
| Version: 0.0.73 | ||
| Summary: 全平台自动化测试框架 | ||
@@ -5,0 +5,0 @@ Home-page: https://gitee.com/bluepang2021/kuto |
+1
-1
@@ -14,3 +14,3 @@ from allure import * | ||
| __version__ = "0.0.72" | ||
| __version__ = "0.0.73" | ||
| __description__ = "全平台自动化测试框架" |
@@ -5,3 +5,5 @@ import json | ||
| from urllib.parse import urlparse | ||
| class AllureData: | ||
@@ -19,2 +21,6 @@ """解析allure_results的数据""" | ||
| file_list.append(filename) | ||
| if not file_list: | ||
| raise KeyError('报告数据为空') | ||
| return [os.path.join(self.result_path, item) for item in os.listdir(self.result_path) if | ||
@@ -35,3 +41,3 @@ item.endswith('result.json')] | ||
| full_name = content.get('fullName') | ||
| decription = content.get('description') | ||
| description = content.get('description') | ||
| parameters = content.get('parameters', None) | ||
@@ -43,10 +49,16 @@ log_name = [os.path.join(self.result_path, item.get('source')) for item in content.get('attachments') if | ||
| end = content.get('stop') | ||
| cost = (end - start) / 1000 | ||
| if cost > 60: | ||
| cost = '{}min'.format(round(cost / 60, 1)) | ||
| else: | ||
| cost = '{}s'.format(round((end - start) / 1000, 1)) | ||
| case_data = { | ||
| "name": name, | ||
| "full_name": full_name, | ||
| "description": decription, | ||
| "log_data": log_data, | ||
| "title": name, | ||
| "name": full_name, | ||
| "description": description, | ||
| "log": log_data, | ||
| "status": status, | ||
| "start_time": start, | ||
| "end_time": end, | ||
| "cost": cost, | ||
| "parameters": parameters | ||
@@ -62,3 +74,3 @@ } | ||
| for item in json_contents: | ||
| full_name = item["full_name"] | ||
| full_name = item["name"] | ||
| parameters = item["parameters"] | ||
@@ -70,3 +82,3 @@ if (full_name, parameters) not in no_repeat_tags: | ||
| for case in case_list: | ||
| if case.get('full_name') == full_name and case.get('parameters') == parameters: | ||
| if case.get('name') == full_name and case.get('parameters') == parameters: | ||
| if case.get('status') != 'passed': | ||
@@ -91,7 +103,10 @@ case_list.remove(case) | ||
| for case in case_list: | ||
| log = case.get('log_data') | ||
| log = case.get('log') | ||
| for line in log.split("\n"): | ||
| if 'url]: ' in line: | ||
| interface = line.strip().split('url]: ')[1] | ||
| interface_list.append(interface) | ||
| parsed_url = urlparse(interface) | ||
| path = parsed_url.path | ||
| method = line.strip().split('[method]: ')[1].split()[0].lower() | ||
| interface_list.append((method, path)) | ||
@@ -119,14 +134,19 @@ interface_list = list(set(interface_list)) | ||
| # 获取整个任务的开始和结束时间 | ||
| start_time, end_time = case_list[0].get('start_time'), case_list[0].get('end_time') | ||
| start_time_timestamp, end_time_timestamp = case_list[0].get('start_time'), case_list[0].get('end_time') | ||
| for case in case_list: | ||
| inner_start = case.get('start_time') | ||
| inner_end = case.get('end_time') | ||
| if inner_start < start_time: | ||
| start_time = inner_start | ||
| if inner_end > end_time: | ||
| end_time = inner_end | ||
| if inner_start < start_time_timestamp: | ||
| start_time_timestamp = inner_start | ||
| if inner_end > end_time_timestamp: | ||
| end_time_timestamp = inner_end | ||
| # 时间戳转成日期 | ||
| start_time, end_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(start_time / 1000)), \ | ||
| time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(end_time / 1000)) | ||
| start_time, end_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(start_time_timestamp / 1000)), \ | ||
| time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(end_time_timestamp / 1000)) | ||
| cost = (end_time_timestamp - start_time_timestamp) / 1000 | ||
| if cost > 60: | ||
| cost = '{}min'.format(round(cost / 60, 1)) | ||
| else: | ||
| cost = '{}s'.format(round((end_time_timestamp - start_time_timestamp) / 1000, 1)) | ||
@@ -139,3 +159,4 @@ return { | ||
| 'start': start_time, | ||
| 'end': end_time | ||
| 'end': end_time, | ||
| 'cost': cost | ||
| } | ||
@@ -146,5 +167,14 @@ | ||
| return { | ||
| "statistics": self.get_statistical_data(), | ||
| "summary": self.get_statistical_data(), | ||
| "interfaces": self.get_interfaces(), | ||
| "cases": self.get_results() | ||
| "tests": [ | ||
| { | ||
| "id": i+1, | ||
| "title": case.get("title"), | ||
| "name": case.get("name"), | ||
| "status": case.get("status"), | ||
| "cost": case.get("cost"), | ||
| "log": case.get("log") | ||
| } for i, case in enumerate(self.get_results()) | ||
| ] | ||
| } | ||
@@ -151,0 +181,0 @@ |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: kuto | ||
| Version: 0.0.72 | ||
| Version: 0.0.73 | ||
| Summary: 全平台自动化测试框架 | ||
@@ -5,0 +5,0 @@ Home-page: https://gitee.com/bluepang2021/kuto |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
227864
0.52%5481
0.5%