项目实战八---获取返回值用于下一个接口的依赖数据
作者:互联网
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正则匹配关联用例
标签:extractor,..,接口,---,user,key,返回值,value,id 来源: https://www.cnblogs.com/lynne-wu/p/14458934.html