kuto
Advanced tools
+1
-2
@@ -9,7 +9,6 @@ import kuto | ||
| kuto.main( | ||
| platform="api", | ||
| host='https://app-pre.qizhidao.com', | ||
| path='tests/test_api.py' | ||
| case_path="tests/test_api.py" | ||
| ) | ||
| Metadata-Version: 2.1 | ||
| Name: kuto | ||
| Version: 0.0.71 | ||
| Version: 0.0.72 | ||
| Summary: 全平台自动化测试框架 | ||
@@ -5,0 +5,0 @@ Home-page: https://gitee.com/bluepang2021/kuto |
+2
-1
@@ -11,5 +11,6 @@ from allure import * | ||
| depend, order, data, file_data | ||
| from kuto.utils.allure_util import AllureData | ||
| __version__ = "0.0.71" | ||
| __version__ = "0.0.72" | ||
| __description__ = "全平台自动化测试框架" |
@@ -6,3 +6,3 @@ app: | ||
| common: | ||
| base_url: http://www.baidu.com | ||
| base_url: null | ||
| headers: {} | ||
@@ -9,0 +9,0 @@ web: |
@@ -7,2 +7,4 @@ import inspect | ||
| from kuto.utils.log import logger | ||
| from kuto.utils.allure_util import AllureData | ||
| from kuto.api.request import formatting | ||
@@ -80,2 +82,7 @@ | ||
| logger.info("================================================================================================") | ||
| logger.info("测试结果数据:") | ||
| logger.info(formatting(AllureData().report_data)) | ||
| logger.info("================================================================================================") | ||
| # api参数保存 | ||
@@ -82,0 +89,0 @@ config.set_common("base_url", None) |
| import json | ||
| import os.path | ||
| import time | ||
@@ -8,6 +9,4 @@ | ||
| def __init__(self, result_path, product=None, test_type=None): | ||
| def __init__(self, result_path='report'): | ||
| self.result_path = result_path | ||
| self.product = product | ||
| self.test_type = test_type | ||
@@ -39,2 +38,3 @@ def get_files(self): | ||
| item.get('name') == 'log'][0] | ||
| log_data = open(log_name, 'r', encoding='utf8').read() | ||
| start = content.get('start') | ||
@@ -46,3 +46,3 @@ end = content.get('stop') | ||
| "description": decription, | ||
| "log": log_name, | ||
| "log_data": log_data, | ||
| "status": status, | ||
@@ -84,2 +84,15 @@ "start_time": start, | ||
| def get_interfaces(self): | ||
| case_list = self.get_results() | ||
| interface_list = [] | ||
| for case in case_list: | ||
| log = case.get('log_data') | ||
| for line in log.split("\n"): | ||
| if 'url]: ' in line: | ||
| interface = line.strip().split('url]: ')[1] | ||
| interface_list.append(interface) | ||
| interface_list = list(set(interface_list)) | ||
| return interface_list | ||
| def get_statistical_data(self): | ||
@@ -112,2 +125,6 @@ case_list = self.get_results() | ||
| # 时间戳转成日期 | ||
| 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)) | ||
| return { | ||
@@ -119,8 +136,14 @@ 'total': total, | ||
| 'start': start_time, | ||
| 'end': end_time, | ||
| 'product': self.product, | ||
| 'type': self.test_type | ||
| 'end': end_time | ||
| } | ||
| @property | ||
| def report_data(self): | ||
| return { | ||
| "statistics": self.get_statistical_data(), | ||
| "interfaces": self.get_interfaces(), | ||
| "cases": self.get_results() | ||
| } | ||
| def get_allure_data(result_path): | ||
@@ -130,46 +153,1 @@ """兼容邮件和钉钉的调用""" | ||
| class ApiData(AllureData): | ||
| """接口测试统计数据""" | ||
| def __init__(self, result_path, product=None): | ||
| super(ApiData, self).__init__(result_path, product, 'api') | ||
| def get_interfaces(self): | ||
| case_list = self.get_results() | ||
| interface_list = [] | ||
| for case in case_list: | ||
| log = case.get('log') | ||
| with open(log, 'r') as f: | ||
| for line in f.readlines(): | ||
| if 'url]: ' in line: | ||
| interface = line.strip().split('url]: ')[1] | ||
| interface_list.append(interface) | ||
| interface_list = list(set(interface_list)) | ||
| return interface_list | ||
| def get_statistic_data(self): | ||
| statistic_data: dict = self.get_statistical_data() | ||
| interface_count = len(self.get_interfaces()) | ||
| statistic_data["num"] = interface_count | ||
| return statistic_data | ||
| class AppData(AllureData): | ||
| """app测试统计数据""" | ||
| def __init__(self, result_path, product=None): | ||
| super(AppData, self).__init__(result_path, product, 'app') | ||
| def get_statistic_data(self): | ||
| return self.get_statistical_data() | ||
| class WebData(AllureData): | ||
| """web页面测试统计数据""" | ||
| def __init__(self, result_path, product=None): | ||
| super(WebData, self).__init__(result_path, product, 'web') | ||
| def get_statistic_data(self): | ||
| return self.get_statistical_data() | ||
+1
-1
| Metadata-Version: 2.1 | ||
| Name: kuto | ||
| Version: 0.0.71 | ||
| Version: 0.0.72 | ||
| Summary: 全平台自动化测试框架 | ||
@@ -5,0 +5,0 @@ Home-page: https://gitee.com/bluepang2021/kuto |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
226676
-0.07%5454
-0.15%