1 |
- {"name": "$ddt{name}", "status": "broken", "statusDetails": {"message": "Exception: 规范yaml文件standard_yaml异常:Traceback (most recent call last):\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 29, in send_request\n kwargs[key] = self.replace_value(value)\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 82, in replace_value\n new_index = getattr(DubugTalk(), function_name)(*args_value2)\n File \"D:\\zdh\\pythonProject\\random1111.py\", line 20, in read_yaml\n return read_yaml(key)\n File \"D:\\zdh\\pythonProject\\common\\yaml_util.py\", line 16, in read_yaml\n return value[key]\nTypeError: 'NoneType' object is not subscriptable\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 112, in standard_yaml\n res = self.send_request(name, method, url, **arg_names['request'])\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 55, in send_request\n error_log(\"发送请求send_request异常:%s\" % str(traceback.format_exc()))\n File \"D:\\zdh\\pythonProject\\common\\log_util.py\", line 68, in error_log\n raise Exception(message)\nException: 发送请求send_request异常:Traceback (most recent call last):\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 29, in send_request\n kwargs[key] = self.replace_value(value)\n File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 82, in replace_value\n new_index = getattr(DubugTalk(), function_name)(*args_value2)\n File \"D:\\zdh\\pythonProject\\random1111.py\", line 20, in read_yaml\n return read_yaml(key)\n File \"D:\\zdh\\pythonProject\\common\\yaml_util.py\", line 16, in read_yaml\n return value[key]\nTypeError: 'NoneType' object is not subscriptable", "trace": "self = <common.request_util.RequestUtil object at 0x0000022934A94550>\nname = '$ddt{name}', method = 'post'\nurl = 'http://221.229.99.73:63220/api/service-sysmgr/auth/AccessController/create'\nkwargs = {'headers': {'Token': '${read_yaml(token)}'}, 'json': {'appCode': '测试871', 'appId': '1705048780670922752', 'appName': 'APP名称name871', 'appType': 2, ...}}\nkey = 'headers', value = {'Token': '${read_yaml(token)}'}\n\n def send_request(self, name, method, url, **kwargs):\n try:\n # 请求方式处理\n method = str(method).lower()\n # 基础路径拼接以及替换\n url = self.base_url + self.replace_value(url)\n # 参数替换\n for key, value in kwargs.items():\n if key in ['params', 'data', 'json', 'headers']:\n> kwargs[key] = self.replace_value(value)\n\ncommon\\request_util.py:29: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = <common.request_util.RequestUtil object at 0x0000022934A94550>\ndata = {'Token': '${read_yaml(token)}'}\n\n def replace_value(self, data):\n if data:\n # 保存数据类型\n data_type = type(data)\n \n # 判断数据类型\n if isinstance(data, dict) or isinstance(data, list):\n str_data = json.dumps(data)\n else:\n str_data = str(data)\n # 替换\n for cs in range(1, str_data.count('${') + 1):\n if \"${\" in str_data and \"}\" in str_data:\n start_index = str_data.index(\"${\")\n end_index = str_data.index(\"}\", start_index)\n old_index = str_data[start_index:end_index + 1]\n # 反射,通过类的对象和方法,字符串调用方法\n function_name = old_index[2:old_index.index('(')]\n args_value = old_index[old_index.index(\"(\") + 1:old_index.index(\")\")]\n new_index = \"\"\n if args_value != \"\":\n args_value2 = args_value.split(',')\n> new_index = getattr(DubugTalk(), function_name)(*args_value2)\n\ncommon\\request_util.py:82: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = <random1111.DubugTalk object at 0x0000022934A949A0>, key = 'token'\n\n def read_yaml(self, key):\n> return read_yaml(key)\n\nrandom1111.py:20: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nkey = 'token'\n\n def read_yaml(key):\n with open(os.getcwd() + '/extract.yaml', mode='r', encoding='utf-8') as f:\n value = yaml.load(stream=f, Loader=yaml.FullLoader)\n> return value[key]\nE TypeError: 'NoneType' object is not subscriptable\n\ncommon\\yaml_util.py:16: TypeError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <common.request_util.RequestUtil object at 0x0000022934A94550>\narg_names = {'extract': {'quarterId': '\"quarterId\":\"(.*?)\"'}, 'request': {'headers': {'Token': '${read_yaml(token)}'}, 'json': {'a...70922752', 'appName': 'APP名称name${get_random_number(1,1000)}', 'appType': 2, ...}}, 'validate': [{'contains': 'data'}]}\n\n def standard_yaml(self, arg_names):\n try:\n logs(\"--------接口测试开始--------\")\n arg_names_keys = arg_names.keys()\n # 判断一级关键字是否存在:name,request,validate\n if \"name\" in arg_names_keys and \"request\" in arg_names_keys and \"validate\" in arg_names_keys:\n # 判断requests下面是否包含method,url\n request_keys = arg_names['request'].keys()\n if \"method\" in request_keys and \"url\" in request_keys:\n logs(\"yaml框架检查基本通过\")\n # pop返回该值,并删除\n name = arg_names.pop(\"name\")\n method = arg_names['request'].pop(\"method\")\n url = arg_names['request'].pop(\"url\")\n # 发送请求\n> res = self.send_request(name, method, url, **arg_names['request'])\n\ncommon\\request_util.py:112: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = <common.request_util.RequestUtil object at 0x0000022934A94550>\nname = '$ddt{name}', method = 'post'\nurl = 'http://221.229.99.73:63220/api/service-sysmgr/auth/AccessController/create'\nkwargs = {'headers': {'Token': '${read_yaml(token)}'}, 'json': {'appCode': '测试871', 'appId': '1705048780670922752', 'appName': 'APP名称name871', 'appType': 2, ...}}\nkey = 'headers', value = {'Token': '${read_yaml(token)}'}\n\n def send_request(self, name, method, url, **kwargs):\n try:\n # 请求方式处理\n method = str(method).lower()\n # 基础路径拼接以及替换\n url = self.base_url + self.replace_value(url)\n # 参数替换\n for key, value in kwargs.items():\n if key in ['params', 'data', 'json', 'headers']:\n kwargs[key] = self.replace_value(value)\n elif key == 'files':\n for file_key, file_path in value.items():\n value[file_key] = open(file_path, 'rb')\n # 输出日志\n \n logs(\"请求名称:%s\" % name)\n logs(\"请求方式:%s\" % method)\n logs(\"请求路径:%s\" % url)\n if \"headers\" in kwargs.keys():\n logs(\"请求头:%s\" % kwargs[\"headers\"])\n if \"params\" in kwargs.keys():\n logs(\"请求params参数:%s\" % kwargs[\"params\"])\n elif \"data\" in kwargs.keys():\n logs(\"请求data参数:%s\" % kwargs[\"data\"])\n elif \"json\" in kwargs.keys():\n logs(\"请求json参数:%s\" % kwargs[\"json\"])\n if \"files\" in kwargs.keys():\n logs(\"文件上传:%s\" % kwargs[\"files\"])\n # 请求\n res = RequestUtil.sess.request(method, url, **kwargs)\n logs(\"实际结果: %s\" % res)\n return res\n \n \n except Exception as e:\n> error_log(\"发送请求send_request异常:%s\" % str(traceback.format_exc()))\n\ncommon\\request_util.py:55: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nmessage = '发送请求send_request异常:Traceback (most recent call last):\\n File \"D:\\\\zdh\\\\pythonProject\\\\common\\\\request_util.py\", line...on\\\\yaml_util.py\", line 16, in read_yaml\\n return value[key]\\nTypeError: \\'NoneType\\' object is not subscriptable\\n'\n\n def error_log(message):\n LoggerUtil().create_log().error(message)\n> raise Exception(message)\nE Exception: 发送请求send_request异常:Traceback (most recent call last):\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 29, in send_request\nE kwargs[key] = self.replace_value(value)\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 82, in replace_value\nE new_index = getattr(DubugTalk(), function_name)(*args_value2)\nE File \"D:\\zdh\\pythonProject\\random1111.py\", line 20, in read_yaml\nE return read_yaml(key)\nE File \"D:\\zdh\\pythonProject\\common\\yaml_util.py\", line 16, in read_yaml\nE return value[key]\nE TypeError: 'NoneType' object is not subscriptable\n\ncommon\\log_util.py:68: Exception\n\nDuring handling of the above exception, another exception occurred:\n\nself = <test_case.qccq.test_allAPI2.TestAPI object at 0x00000229348EA230>\narg_names = {'extract': {'quarterId': '\"quarterId\":\"(.*?)\"'}, 'request': {'headers': {'Token': '${read_yaml(token)}'}, 'json': {'a...70922752', 'appName': 'APP名称name${get_random_number(1,1000)}', 'appType': 2, ...}}, 'validate': [{'contains': 'data'}]}\n\n> ???\n\nD:\\zdh\\pythonProject\\cwtcase\\qccq\\test_allAPI2.py:18: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\ncommon\\request_util.py:154: in standard_yaml\n error_log(\"规范yaml文件standard_yaml异常:%s\" % str(traceback.format_exc()))\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nmessage = '规范yaml文件standard_yaml异常:Traceback (most recent call last):\\n File \"D:\\\\zdh\\\\pythonProject\\\\common\\\\request_util.py\",...\\\\yaml_util.py\", line 16, in read_yaml\\n return value[key]\\nTypeError: \\'NoneType\\' object is not subscriptable\\n\\n'\n\n def error_log(message):\n LoggerUtil().create_log().error(message)\n> raise Exception(message)\nE Exception: 规范yaml文件standard_yaml异常:Traceback (most recent call last):\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 29, in send_request\nE kwargs[key] = self.replace_value(value)\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 82, in replace_value\nE new_index = getattr(DubugTalk(), function_name)(*args_value2)\nE File \"D:\\zdh\\pythonProject\\random1111.py\", line 20, in read_yaml\nE return read_yaml(key)\nE File \"D:\\zdh\\pythonProject\\common\\yaml_util.py\", line 16, in read_yaml\nE return value[key]\nE TypeError: 'NoneType' object is not subscriptable\nE \nE During handling of the above exception, another exception occurred:\nE \nE Traceback (most recent call last):\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 112, in standard_yaml\nE res = self.send_request(name, method, url, **arg_names['request'])\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 55, in send_request\nE error_log(\"发送请求send_request异常:%s\" % str(traceback.format_exc()))\nE File \"D:\\zdh\\pythonProject\\common\\log_util.py\", line 68, in error_log\nE raise Exception(message)\nE Exception: 发送请求send_request异常:Traceback (most recent call last):\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 29, in send_request\nE kwargs[key] = self.replace_value(value)\nE File \"D:\\zdh\\pythonProject\\common\\request_util.py\", line 82, in replace_value\nE new_index = getattr(DubugTalk(), function_name)(*args_value2)\nE File \"D:\\zdh\\pythonProject\\random1111.py\", line 20, in read_yaml\nE return read_yaml(key)\nE File \"D:\\zdh\\pythonProject\\common\\yaml_util.py\", line 16, in read_yaml\nE return value[key]\nE TypeError: 'NoneType' object is not subscriptable\n\ncommon\\log_util.py:68: Exception"}, "attachments": [{"name": "log", "source": "fcda3fae-a9d0-4f58-9762-4c7345a18eb9-attachment.txt", "type": "text/plain"}], "parameters": [{"name": "arg_names", "value": "{'name': '$ddt{name}', 'request': {'method': 'post', 'url': '/service-sysmgr/auth/AccessController/create', 'json': {'appCode': '测试${get_random_number(1,1000)}', 'systemName': '测试${get_random_number(1,9000)}', 'sponsor': 1675680915889610752, 'logoUrl': '20230922/dbc9d08ffc8f43609e9e8192e2ebe48c.jpg', 'appType': 2, 'appName': 'APP名称name${get_random_number(1,1000)}', 'appUrl': 'APP地址${get_random_number(1,9000)}', 'sort': 16, 'publicKey': None, 'privateKey': None, 'mustHex': 0, 'mustAuth': 0, 'state': 1, 'notes': '测试', 'appId': '1705048780670922752'}, 'headers': {'Token': '${read_yaml(token)}'}}, 'extract': {'quarterId': '\"quarterId\":\"(.*?)\"'}, 'validate': [{'contains': 'data'}]}"}], "start": 1706516655678, "stop": 1706516655680, "uuid": "68385582-8827-4ff8-bc32-ca67f68660b3", "historyId": "c377cda91eeea80daf5e2540aa578aa8", "testCaseId": "bf05973f6ceba805900e189264167300", "fullName": "test_case.qccq.test_allAPI2.TestAPI#test_002_接入管理_新增", "labels": [{"name": "epic", "value": "青春重庆"}, {"name": "feature", "value": "用户管理模块"}, {"name": "parentSuite", "value": "test_case.qccq"}, {"name": "suite", "value": "test_allAPI2"}, {"name": "subSuite", "value": "TestAPI"}, {"name": "host", "value": "jwdiannao"}, {"name": "thread", "value": "14124-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "test_case.qccq.test_allAPI2"}]}
|