1
votes

I have REST webservice call via Jmeter. After placing the request, I am getting the response back with response headers.

To view the response headers value I am using View Results Tree listener.
I am able to see the needed parameter under the SamplerResult tab of View Results Tree.
That parameter is an integer value.

My question is : how to take the average value of that parameter from the View Results Tree section for all the requests(5000 requests) that I have submitted

1

1 Answers

0
votes

To do what you want:

  • Declare a User Defined Variable (nbIterations)
  • Use a Regular Expression Extractor (check Headers, call it time)
  • Use a JSR223 Sampler (add Groovy to jmeter/lib/ext/) which will do something like this:

    Long time = (Long) vars.get("time");
    Long sum = (Long) vars.get("sum");
    if(sum == null) {
        sum = new Long(0);
    }
    sum = new Long(sum.longValue()+time.longValue);
    vars.put("sum", sum);
    
  • Finally you have it through {__BeanShell(${sum}/${nbIterations})}