JSON提取器:

$.Data[0].CartItems[0].UID

jmeter获取响应数据中参数值的常用方式(JSON提取器 、正则表达式提取器 、XPath提取器 、Bean Shell PostProcessor)

 

XPath提取器:

返回数据格式是HTML的时候,选择使用此种方式。

//input[@id='storageId']/@value

jmeter获取响应数据中参数值的常用方式(JSON提取器 、正则表达式提取器 、XPath提取器 、Bean Shell PostProcessor)

 

 

正则表达式提取器:

图中Field to check勾选的是Response Headers,获取的是请求头里的参数值。

jmeter获取响应数据中参数值的常用方式(JSON提取器 、正则表达式提取器 、XPath提取器 、Bean Shell PostProcessor)

 

Bean Shell PostProcessor脚本获取方式:

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;


String jsonContent = prev.getResponseDataAsString();

JSONObject response = JSON.parseObject(jsonContent);
JSONArray phaseList = response.getJSONArray("phaseList");
JSONObject phase = phaseList.getJSONObject(0);
String ChannelOrderNo = phase.getString("ChannelOrderNo");

vars.put("ChannelOrderNo", ChannelOrderNo);

jmeter获取响应数据中参数值的常用方式(JSON提取器 、正则表达式提取器 、XPath提取器 、Bean Shell PostProcessor)

 

相关文章:

  • 2021-12-05
  • 2021-12-12
  • 2021-06-24
  • 2022-02-20
  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
相关资源
相似解决方案