项目实战八---获取返回值用于下一个接口的依赖数据
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正则匹配关联用例
本文来自博客园,作者:%女王%,转载请注明原文链接:https://www.cnblogs.com/lynne-wu/p/14458934.html