how to parse a value in JMeter sampler result
I am unable to calculate the response header size in Jmeter.
I want to calculate the response header size and i tried below option but i was unsuccessful. Option 1: Parse the value returned in Sampler result --> i do not have an inbuilt option. Option 2: Store the response header in a variable and calculate the length using var.length() function. --> since the response header have new line feeds, the .length function did not work.
Can anyone please suggest me to calculate the response header size in bytes.
Thanks in advance,
It should be something like:
previs a shorthand to SampleResult class instance.
Be aware that starting from JMeter 3.1 users are encouraged to switch to JSR223 Test Elements and Groovy language for any form of scripting as Groovy:
- is more Java-compliant including modern language features
- has enhancements on top of Java SDK
- has much better performance
See Apache Groovy - Why and How You Should Use It article for more details
We can also do in BeanShell and below is the snippet of the Code
Add a Bean Shell Post Processor
response_Header = prev.getResponseHeaders(); response_Header_Size = new Integer(response_Header.length()); vars.put("response_Header_Size", response_Header_Size.toString());
Works for Jmeter 2.13