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正则匹配关联用例