python学习

1. 全面熟悉Requests库,以及底层调用逻辑

安装:pip install requests

请求四要素:请求方式(get,post,put,delete),请求地址,请求头,请求参数,**kwags其他参数

params 传参  路径后以?传

json  传参json

data 传参表单

files 传参文件

image

image

session自动关联cookie

image

image

 

响应四要素:响应码,响应头,响应信息,响应正文

image

 

image

image

通过命令安装所有插件:pip3 install -r requirements.txt

image

[pytest]
addopts = -vs -m "smoke and www" --html=./reports/report.html
testpaths = ./testcase
python_files = test_*.py
python_classes = Test*
python_function = test_*
#给方法打标 @pytest.mark.smoke
markers =
smoke:冒烟测试
www:随便

image

image

 

image

 

image

image

image

用例封装

image

断言封装

image

 

 allure报告美化:

image

日志的封装

 

image

 面试宝典

image

 

posted @ 2025-11-10 20:39  程程111  阅读(9)  评论(0)    收藏  举报