摘要: 基本认证是允许http用户代理(如:网页浏览器)在请求时,提供用户名和密码的一种方式。 自动化测试中,可以用auth参数传递认证信息 import requests from requests.auth import HTTPBasicAuth def test_auth(): r = reques 阅读全文
posted @ 2021-09-09 15:42 feifei_tian 阅读(76) 评论(0) 推荐(0) 编辑
摘要: Cookie使用场景 在接口测试过程中, 很多情况下,需要发送的请求附带cookies,才能返回正常的结果。所以在使用python+requests进行接口自动化测试也是同理, 需要在构造接口测试用例时加入cookie。 传递Cookie的两种方式: 1. 请求头headers信息传递 import 阅读全文
posted @ 2021-09-09 14:34 feifei_tian 阅读(52) 评论(0) 推荐(0) 编辑
摘要: http://hamcrest.org/ import requests from hamcrest import * def test_post_json(self): payload = { "level": 1, "name": "xuefeifei" } r = requests.post( 阅读全文
posted @ 2021-09-09 10:21 feifei_tian 阅读(46) 评论(0) 推荐(0) 编辑
摘要: import requests from jsonpath import jsonpath def test_post_json(self): payload = { "level": 1, "name": "xuefeifei" } r = requests.post("https://httpb 阅读全文
posted @ 2021-09-09 10:03 feifei_tian 阅读(159) 评论(0) 推荐(0) 编辑
摘要: import requests class TestDemo: def test_get(self): r = requests.get("https://www.baidu.com/") print(r.status_code) assert r.status_code == 200 def te 阅读全文
posted @ 2021-09-08 17:04 feifei_tian 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 第16次预习课 mysql 20181024 >mysql –uroot –p #默认是3306端口,IP是localhost CREATE DATABASE IF NOT EXISTS testnewman DEFAULT CHARSET utf8 COLLATE utf8_general_ci; 阅读全文
posted @ 2018-12-07 14:35 feifei_tian 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 第15次预习课-数据库mysql 1. 安装mysql 下载地址:https://dev.mysql.com/downloads/windows/installer/ 2.安装完后,查看是否成功 C:\Users\Xue Feifei>cd C:\Program Files\MySQL\MySQL 阅读全文
posted @ 2018-12-06 14:41 feifei_tian 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 10-31 接口测试 pip install requests http协议 客户端(浏览器、使用cmd):发送请求包-》网站服务器,返回给客户服务器一个响应包 请求包: 首部:header(可为空) 主体:body(可为空) 响应包: 首部:header(可为空) 主体:body(可为空) >>> 阅读全文
posted @ 2018-12-05 11:16 feifei_tian 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 第19次全天课笔记 20181202 WiFi密码:46702126 正则表达式练习 1 统计文章的字母个数 >>> re.findall(r"[a-zA-Z]","ab 78 cd 69\n") ['a', 'b', 'c', 'd'] >>> len(re.findall(r"[a-zA-Z]" 阅读全文
posted @ 2018-12-04 11:47 feifei_tian 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 全天课笔记-210181125 写一个类,能够统计某个文件的纯数字字符个数,统计非空白个数,空白个数,行数 能够读取文件中的某一行 通过继承方式,增加一个方法,打印所有的统计信息 import os.path class FileInfo(object): """统计文件的数字字符个数、 非空白数字 阅读全文
posted @ 2018-12-04 11:45 feifei_tian 阅读(77) 评论(0) 推荐(0) 编辑