项目实战八---获取返回值用于下一个接口的依赖数据

Excel中加入一列:extractor

值如下:

{"token":"$..token","user_id":"$..user_id","username":"$..username"}

 

测试用例函数中获取:

extractor = info['extractor']
if extractor:
extractor = json.loads(extractor)
for key, value in extractor.items():
setattr(Handler, key, jsonpath(resp_data, value)[0])


设置类属性,后续用re正则匹配关联用例
posted @ 2021-02-28 14:27  %女王%  阅读(92)  评论(0编辑  收藏  举报