随笔分类 -  Python接口自动化

上一页 1 2 3

python批量执行脚本,使用unittest.TestSuit(); unittest.TextTestRunner().run(); addTest();unittest.defaultTestLoader.discover();
摘要:#alltest.py中内容如下import unittest,osdef all(): #path="D:\\study\\python_api_test\\test1203" #手动添加路径 path=os.getcwd() #获取路径 files=unittest.defaultTestLoa 阅读全文

posted @ 2019-12-03 23:33 星空6 阅读(812) 评论(0) 推荐(0) 编辑

unittest,requests,assertEqual实战演练
摘要:请求方式:POST请求url:https://api.apiopen.top/developerLogin请求参数:名称 类型 必须 描述 示例name string 是 账号 peakchaopasswd string 是 密码 123456 import unittest,requestscla 阅读全文

posted @ 2019-12-02 23:15 星空6 阅读(493) 评论(1) 推荐(0) 编辑

unittest断言
摘要:import unittestclass xixi(unittest.TestCase): def test_1(self): a=3 b=4 #self.assertEqual(a,b) #a,b是否相等,不相等则报错 #self.assertNotEqual(a,b) #a,b不相等,则成功 d 阅读全文

posted @ 2019-12-02 21:47 星空6 阅读(135) 评论(0) 推荐(0) 编辑

unittest执行顺序,使用unittest.main()按照test开头,由0-9,A-Z,a-z的顺序执行; 可使用TestSuite类的addTest方法改变执行顺序;
摘要:import unittestclass Study(unittest.TestCase): # def setUp(self): # print('start') # def tearDown(self): # print('end') def test_login(self): print('l 阅读全文

posted @ 2019-12-01 22:18 星空6 阅读(744) 评论(0) 推荐(0) 编辑

unittest单元测试,基于java的junit测试框架
摘要:import unittestclass study(unittest.TestCase): def testXia(self): self.assertEqual((3*4),20) def testHong(self): self.assertEqual(2,2)if __name__=="__ 阅读全文

posted @ 2019-12-01 17:58 星空6 阅读(1379) 评论(0) 推荐(0) 编辑

使用响应的json数据判断订单查询是否成功;
摘要:#查询中通快递import requestsrr=requests.session()headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chr 阅读全文

posted @ 2019-12-01 16:03 星空6 阅读(341) 评论(0) 推荐(0) 编辑

python session保持登录,新增地址,并删除,由观察可知,address_id决定删除的内容;
摘要:import requests,reheaders={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/5 阅读全文

posted @ 2019-11-30 11:32 星空6 阅读(390) 评论(0) 推荐(0) 编辑

python 正则表达式提取返回内容
摘要:import re re.findall(' <input name="address_id" type="hidden" value="(.*?)" />',neww.content.decode("utf-8")) #返回的是一个列表,使用re.match匹配不到内容;re.findall是匹配 阅读全文

posted @ 2019-11-30 11:30 星空6 阅读(3954) 评论(0) 推荐(0) 编辑

python 登录并获取session,使用session新增ecshop的草稿
摘要:import requestsheader={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.3 阅读全文

posted @ 2019-11-27 22:42 星空6 阅读(616) 评论(0) 推荐(0) 编辑

python cookie登录DVWA,phpstudy搭建DVWA参考https://www.jianshu.com/p/97d874548300
摘要:import requestsheader={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.3 阅读全文

posted @ 2019-11-26 21:48 星空6 阅读(340) 评论(0) 推荐(0) 编辑

上一页 1 2 3

导航