Python3:pytest+request+yaml+allure接口自动化测试

pytest+request+yaml+allure接口自动化测试

一、Pytest的parametrize结合yaml实现数据驱动

1、读取yaml文件数据

ids:
  - [请求方式,请求地址,请求头,请求参数,预期结果]

#测试用例测试数据
testcases:
     test_login:
       - ["POST","http://10.1.1.xx:8081/xx/xx",{"Content-Type": "application/json;charset=UTF-8"},{"userName":"xxx","password":"xxx"},0]
     test_tenant_list:
       - ["POST","http://10.1.1.xx:8081/xx/v1/xx/list",{"content-type":"application/json;charset=UTF-8"},{&#

你可能感兴趣的:(pytest,python3.11)