摘要: 转载请注明出处:https://www.cnblogs.com/shapeL/p/9188495.html 前言:上篇文章python3+requests+unittest:接口自动化测试(一):https://www.cnblogs.com/shapeL/p/9179484.html ,已经介绍了 阅读全文
posted @ 2018-06-19 11:11 Shapelei 阅读(8721) 评论(4) 推荐(5) 编辑
摘要: 转载请表明出处:https://www.cnblogs.com/shapeL/p/9179484.html 简单介绍框架的实现逻辑,参考代码的git地址: https://github.com/zhangying123456/python_unittest_interface 1.环境准备 pyth 阅读全文
posted @ 2018-06-13 19:42 Shapelei 阅读(11270) 评论(0) 推荐(6) 编辑
摘要: python自动化测试脚本运行后,想要将日志保存到某个特定文件,使用python的logging模块实现 参考代码: 1.日志级别使用场景:在终端输出程序或脚本的使用方法:print报告一个事件的发生(例如状态的修改):logging.info()或logging.debug()发生了一个特定的警告 阅读全文
posted @ 2018-06-12 17:41 Shapelei 阅读(6295) 评论(0) 推荐(1) 编辑
摘要: 转载请注明出处:https://www.cnblogs.com/shapeL/p/9172990.html 1.windows任务计划定时执行脚本 (1)创建 .bat 文件,执行脚本的命令(interface.bat) (2)计算机右键--管理--任务计划程序--创建任务 选中(1)中创建的.ba 阅读全文
posted @ 2018-06-12 14:53 Shapelei 阅读(6074) 评论(1) 推荐(2) 编辑
摘要: 转载请表明出处:https://www.cnblogs.com/shapeL/p/9141238.html 前提:文中例子介绍test.json内容: 1.文件读取 (1)打开文件open,默认是已读模式打开文件 read():一次性读取文件所有内容 输出结果中出现乱码:需要给open函数传入enc 阅读全文
posted @ 2018-06-05 18:32 Shapelei 阅读(28968) 评论(0) 推荐(1) 编辑
摘要: 问题:cmd窗口运行python脚本,报错 C:\Users\xxx\Documents\GitHub\python3\main>python run_test.pyTraceback (most recent call last): File "run_test.py", line 9, in < 阅读全文
posted @ 2018-05-31 18:07 Shapelei 阅读(6277) 评论(0) 推荐(1) 编辑
摘要: 转载请表明出处:https://www.cnblogs.com/shapeL/p/9115887.html 1.发送QQ邮件,首先必须知道QQ邮箱的SMTP服务器 http://service.mail.qq.com/cgi-bin/help?id=28&no=167&subtype=1 2.发送邮 阅读全文
posted @ 2018-05-31 11:49 Shapelei 阅读(10436) 评论(3) 推荐(2) 编辑
摘要: 1.xlrd读取excel 请参考上篇博客https://www.cnblogs.com/shapeL/p/9075843.html 2.xlwt生成excel 安装下载:pip install xlwt 导入:import xlwt 参考: 生成excel文件test1.xls 如果对同一单元多次 阅读全文
posted @ 2018-05-30 14:30 Shapelei 阅读(3600) 评论(0) 推荐(1) 编辑
摘要: 前提:接口自动化测试中,存在依赖情况:test_02的某个请求参数的值,需要依赖test_01返回结果中某个字段的数据,所以就先需要拿到返回数据中特定字段的值。这里使用到python中jsonpath-rw库 1.下载安装 pip install jsonpath-rw 2.导入 from json 阅读全文
posted @ 2018-05-29 18:04 Shapelei 阅读(4132) 评论(2) 推荐(0) 编辑
摘要: 转载请注明出处:https://www.cnblogs.com/shapeL/p/9075843.html 前提:自动化接口测试中,可以将用例放在excel中管理。结合实际情况讲解如何操作excel文件 1.安装xlrd:pip install xlrd 2.导入模块:import xlrd 3.打 阅读全文
posted @ 2018-05-23 11:05 Shapelei 阅读(5311) 评论(0) 推荐(1) 编辑