问题描述
在config配置中设置verify参数为false,实际执行时仍会验证证书。
版本信息
请提供如下版本信息:
- 操作系统类型: [e.g. Windows]
- Python 版本 [e.g. 3.7]
- HttpRunner 版本 [e.g. 2.0.0]
堆栈信息
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\site-packages\httprunner\api.py", line 54, in test
test_runner.run_test(test_dict)
File "C:\Program Files\Python37\lib\site-packages\httprunner\runner.py", line 347, in run_test
self._run_test(test_dict)
File "C:\Program Files\Python37\lib\site-packages\httprunner\runner.py", line 234, in _run_test
**parsed_test_request
File "C:\Program Files\Python37\lib\site-packages\httprunner\client.py", line 205, in request
for resp_obj in response_list
File "C:\Program Files\Python37\lib\site-packages\httprunner\client.py", line 205, in
for resp_obj in response_list
File "C:\Program Files\Python37\lib\site-packages\httprunner\client.py", line 102, in get_req_resp_record
req_resp_dict["response"]["ok"] = resp_obj.ok
File "C:\Program Files\Python37\lib\site-packages\requests\models.py", line 701, in ok
self.raise_for_status()
File "C:\Program Files\Python37\lib\site-packages\httprunner\client.py", line 20, in raise_for_status
raise self.error
File "C:\Program Files\Python37\lib\site-packages\httprunner\client.py", line 233, in _send_request_safe_mode
return requests.Session.request(self, method, url, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\requests\sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python37\lib\site-packages\requests\sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python37\lib\site-packages\requests\adapters.py", line 511, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.homelabs.cn', port=443): Max retries exceeded with url: /api/v1/login (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)')))
Ran 1 test in 0.445s
FAILED (errors=1)
variable 'role' can not be found in variables mapping, failed to output!
项目文件结构
.env
│ debugtalk.py
│ main.py
│
├─.idea
│ │ misc.xml
│ │ modules.xml
│ │ test.iml
│ │ workspace.xml
│ │
│ └─inspectionProfiles
├─api
│ ├─json
│ │ │
│ │ ├─api_v1_login
│ │ │ post.json
│ │ │
│ │ ├─api_v1_logout
│ │ │ get.json
│
├─reports
│ 1546595125.html
│ 1546595143.html
│
├─testcases
│ ├─login
│ │ 密码登录.yml
│ │ 账号不存在时登录.yml
│ │ 验证码登录.yml
│ │
│ └─reports
│ 报告上传.yml
│
├─testsuites
├─tools
│ │ database.py
项目文件内容(非必须)
- config:
name: 正常登陆接口测试1
base_url: ${get_base_url()}
verify: false
request:
headers:
Accept: application/json
User-Agent: iOS/10.3
variables:
- act: ${random_account()}
- pwd: "${md5(123456)}"
- role: 1
"output": [
role,
]
- test:
parameters:
- identityType: [passwd]
variables:
- role: 2
setup_hooks:
- ${init_act($act, $pwd, $role)}
name: 正常登陆接口测试
api: api/yml/api_v1_login/post.yml
validate:
- eq: ["status_code", 200]
- eq: ["content.respStatus.code", 200]
提示:请注意在去除项目敏感信息(IP、账号密码、密钥等)后再进行上传。
invalid