接口自动化测试框架
Yang on
扶我起来,我还能学
展开
-
递归获取多层json的路径及对应value
适用存在重复节点的多层jsondef find(dic): result = {} def findpath(dic, temp): for k, v in dic.items(): if isinstance(v, dict): temp += '.{}'.format(str(k)) findpath(v, temp) else:原创 2021-05-08 14:16:36 · 664 阅读 · 2 评论 -
接口自动化测试框架编写之路(4):根据用例标题获取excel中用例所需数据
这里我是使用excle进行用例数据存放的;(后续我会写使用数据库来进行用例数据的存放)excel如下:执行效果如下:代码如下:import osimport pandas as pdDataFilePath = (os.path.abspath(os.path.dirname(__file__)) + '\\' + 'data.xlsx').replace('basefuction', 'element')def getdata(sheet, casetitle): """原创 2021-03-09 21:24:13 · 148 阅读 · 0 评论 -
接口自动化测试框架编写之路(3):使用HTMLTestRunner生成测试报告
在(1)已经发了使用unitest读取txt文件执行批量用例的博文,这里新增生成测试报告的功能;代码如下:import osimport timeimport unittestimport HTMLTestRunnerbase_dir_path = os.path.abspath(os.path.dirname(__file__))def get_case_path(): """ function: 获取所有需要执行的python文件的绝对路径 paras:原创 2021-03-09 21:06:00 · 171 阅读 · 0 评论 -
接口自动化测试框架编写之路(2):封装数据库之oracle
1.python安装第三方库cx_Oracle;2.下载轻量级oracle客户端(版本根据oracle版本来定);2.1 下载地址:https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html(需要登录oracle)2.2 解压instantclient-basic-windows.x64-11.2.0.4.0.zip,获得解压文件夹的路径oraclepath3.在instantclient_原创 2021-03-01 19:34:08 · 156 阅读 · 0 评论 -
接口自动化测试框架编写之路(1):unitest读取txt文件批量执行用例
方法一:获取所有用例py对应的绝对路径def get_case_path(): """ function:获取所有需要执行的python文件的绝对路径 return: cases_paths """ cases_paths = [] txt_path = base_dir_path + '\\' + 'cases_list' with open(txt_path, 'r') as f: while True:原创 2021-02-27 22:52:50 · 243 阅读 · 0 评论