JSR223 PostProcessor VS BeanShell PostProcessor in JMeter
I would recommend using JSR223 PostProcessor
About performance:
In JMeter's official user manual, About reducing resource requirements in Best Practice. There is one suggestion said that "Use the most performing scripting language (see JSR223 section)" , as Beanshell Processfor reduces JMeter's performance.
About parse JSON response:
And I found that it is more easy to parse JSON response compared with BeanShell PostProcessor . As JSR223 PostProcessor supports Groovy, this is easy to parse JSON using Groovy, no need to import additional JAR packages.
Example One:
import groovy.json.JsonSlurper
def jsonSlurper = new JsonSlurper();
String response=prev.getResponseDataAsString();
//log.info("response" + response);
def object = jsonSlurper.parseText(response);
dataAllReady = object.data.dataAllReady;
Example Two:
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def jsonSlurper = new JsonSlurper();
def response = jsonSlurper.parseText(prev.getResponseDataAsString());
def json = JsonOutput.toJson(response.details[0].outBound[0]);
vars.put("json", json);
Reference:
- Parsing and producing JSON - to learn how to work with JSON in Groovy
- Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For!
浙公网安备 33010602011771号