1. 首先存储一个接口的响应结果,如在http请求的BeanShell PostProcessor:
import java.io.UnsupportedEncodingException;
System.out.println(prev.getResponseCode());
String str = prev.getResponseDataAsString();
/*
String result = ${__urldecode(str)};
System.out.println("------------"+result);
*/
String result = "";
try {
result = java.net.URLDecoder.decode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println("--------"+result);
vars.put("result",result);
log.info(result);
或者是jdbc request中BeanShell PostProcessor:
columnValue = vars.getObject("testresultvariable").get(0).get("app_id");
vars.put("value",columnValue);
变量存储好后,