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:

相关文章:

  • 2022-01-11
  • 2022-01-06
  • 2021-12-04
  • 2022-12-23
  • 2022-01-04
  • 2021-08-21
猜你喜欢
  • 2018-08-08
  • 2021-09-01
  • 2021-11-22
  • 2021-04-13
  • 2018-08-08
相关资源
相似解决方案