一、Jmeter->线程组->后置处理器->BeanShell后置处理器
二、代码(模板)
import java.io.UnsupportedEncodingException;
import org.apache.jmeter.assertions.AssertionResult;
import org.json.*;
String response ="";
String Str ="SUCCESS";
response = prev.getResponseDataAsString();
if(response == "")
{
Failure = true;
FailureMessage = "系统无响应,获取不到响应数据";
log.info(FailureMessage);
try {
result = java.net.URLDecoder.decode(str, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
}
else if(response.contains(Str) == false){
Failure = true;
String Msg = "系统返回与检查点不一致";
FailureMessage = "\n" + Msg + "\n" +