标签:extractor pre mic tool 执行 variable post 图片 loading
想要解决的问题:
测试时,token等前面接口返回的数据,后面的请求时需要用到,通过查询接口,获取response数据,作为下个请求post的参数值
1.先下载一个插件:JSONPathExtractor,使用时位置如图:

2.JSON提取器的参数说明

Names of created variables: 后续请求的参数名称
JSON Path expressions:JSON表达式 ,用$表示json返回数据的整体。
Match No.(0 for Random):匹配哪个,可为空即默认第一个
Default Values:未取到值的时候默认值
3.举例response返回JSON数据:
JSON Path expressions 中:取值token,可用$.data.token
4.后续使用方法

后面的HTTP请求需要前面的参数时,token直接用${token}即可。
5.返回数据较多的举例
如下,response返回数据:
{
"code": 2000,
"message": "success",
"body": {
"identifier": "JKCS5449-4",
"useScopeStr": "全部",
"executeTypeStr": "按周执行",
"timeDTOList": [
{
"executeTime": "08:00",
"weekStr": "星期六"
}
]
}
}
JSON Path expressions 中:
1. 取值identifier,可用$.body.identifier
2. 取值weekStr(数组),可用$.body.timeDTOList[0].weekStr
原文参考:https://www.cnblogs.com/rechin/p/8662744.html
如果想使用正则表达式提取,可参考:https://www.cnblogs.com/rechin/p/9134069.html
标签:extractor pre mic tool 执行 variable post 图片 loading
原文地址:https://www.cnblogs.com/jintianniu/p/13301301.html