Combine response with JMeter when "Transfer-Encoding:chunked" is enabled - jmeter

I'm writing a performance test script in JMeter, but the site uses "Transfer-Encoding: chunked".
Is it possible to receive and combine all responses with JMeter?
I tried "prev.getResponseData ();" in JSR223 PostProcessor, but it seems that I can only get the last response.

JSR223 PostProcessor obeys JMeter Scoping Rules so it's just a matter of proper placement
As you can see
JSR223 PostProcessor 1 is applied only to Sampler 1
and JSR223 PostProcessor 2 is applied to all 3 Samplers

Related

jmeter is not running script in the order it is written

In jmeter, I'm using nested loop controllers, along with some JSR223 postprocessors inside each loop
Here's the order the script is written:
Loop Controller
Loop Controller
http request
Endloop
JSR223 postprocessor
Endloop
I want the script to first run the http request (multiple times), then after that looping is complete, run the JSR223 postprocessor, then repeat all that.
Instead, what is happening is it enters into the first Loop Controller, then runs the JSR223 postprocessor, then runs the second nested Loop Controller.
Why? How do I get it to run the script in the order in which it's written from top to bottom and nested?
Change from using postprocessor , which is executed for every request in scope, to sampler which executed once
Some elements in the test trees are strictly hierarchical (Listeners, Config Elements, Post-Processors, Pre-Processors, Assertions, Timers), and some are primarily ordered (controllers, samplers). 
Another option is to add it under Sampler which will execute it omce after sampler
JSR223 PostProcessor is being executed after each Sampler in its Scope, in your case after each iteration of the HTTP Request sampler.
If you want to run it only once - either put Flow Control Action sampler at the place of the JSR223 PostProcessor and make the JSR223 PostProcessor a child of the Flow Control Action sampler.
Otherwise you can use JSR223 Sampler instead of the JSR223 PostProcessor, if you don't want the JSR223 Sampler to appear in test results - put SampleResult.setIgnore() function somewhere in your script.

Where to place the standalone JSR223 samplers in between HTTP posts inside a while controller

I have the while controller (as long as a flag is false) which has multiple IFs like:
I need to set the flag once certain conditions are satisfied at various places. Where do I need to place the stand alone JSR223 sampler to reset the flag? The locations I have placed it as highlighted is throwing error ('Method getCookieManager() not found in class...' ) as my JSR223 sampler doesn't have an instance of the HTTP Cookie Manager because I have brought the cookies from the one-off setUp thread group to main thread group (payment - via BS PreProcessor).
If you're using Beanshell PreProcessor and Beanshell PostProcessor for passing cookies between setup and "normal" thread groups - you need to change their location, to wit:
Put Beanshell PostProcessor as a child of the 02 LOGIN sampler
Put Beanshell PreProcessor as a child of the 04 GET PAYT sampler
as soon as you do this all getCookieManager() not found in class errors will go away
Consider migrating from the Beanshell Pre and PostProcessor to the JSR223 equivalents as they may become performance bottleneck when it comes to high loads, see Apache Groovy - Why and How You Should Use It article for more details

How to wait all threads to complete a Sampler before starting its Post Processor

I have 2 samplers with JSR223 post processors in each. I want threads to wait before starting the Post Processor.
If there are multiple threads are running the sampler, I want to start the Post processor execution after all the threads complete the sampler.
Please let me know how to do this.
You won't be able to achieve this using JSR223 PostProcessor as all JMeter threads (virtual users) are absolutely independent and will start the PostProcessor as soon as sampler will be completed.
So I would suggest amending your test as follows:
Sampler 1
Sampler 2
JSR223 Sampler
Synchronizing Timer
The Synchronizing Timer will act as a "rendezvous" point so this way you will be sure that all threads have finished Samplers execution and will start your JSR223 Sampler at exactly the same moment.
If you don't want JSR223 Sampler to generate Sample Result - add SampleResult.setIgnore() somewhere in your script.

Which one is efficient : Java Request, JSR223 or BeanShell Sampler for my script

I want to send a a byte array which is not possible with the inbuilt HTTP Sampler.
So went ahead with BeanShell sampler.
But i found some time lagging in response of BeanShell Sampler
In my code I am sending a hard-coded byte array to the web service endpoint.
Is there a better approach like Java Request or JSR223 whose execution time is lesser than that of beanshell sampler
Well-behaved JSR223 Sampler with Groovy language and Compilation Cache feature enabled will work faster and have lesser memory footprint than Beanshell. Remember not to reference JMeter Functions or Variables in form of ${var} directly in Groovy script body.
Java Request sampler will the fastest one, however it will be harder to make changes as you will have to recompile your code, put it to JMeter Classpath and restart JMeter even for trivial change.
More information: Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For!
Particularly in your case you can use HTTP Raw Request instead of scripting.
You should be able to enable Use multipart/form-data in HTTP Request Sampler and then send your array as parameter.
You can store byte[] in variable using Beanshell:
byte[] arr = new byte[] {...};
vars.putObject("myByteArray", arr);
After that just refer to variable as usual ${myByteArray}.

There are 5 Parallel request executing in under 1 TR controller of Jmeter

Let,c These below are the 5 request in one Transaction controller
https//detailslist/Json/1
https//detailslist/Json/2
https//detailslist/Json/3
https//detailslist/Json/4
https//detailslist/Json/5
Note : Above request are executing parallel in browser and the response time of the browser is one of the highest response time of the request (request 4 is having high response time i;e 6 sec and this is the total response time of this page)
In Jmeter what is happening, It is giving response time sum of all 5 request i;e 12 sec.Which is higher than browser.
How we can do this in Jmeter. is there any solution or option are available in jmeter to execute request parallel in jmeter.
Thanks in advance to people who will answer.
JMeter executes sequentially samplers under Transaction Sampler.
There is an enhancement request for that but I am not sure it will be implemented one day:
https://bz.apache.org/bugzilla/show_bug.cgi?id=53159
To do this , you would have to code a JSR223 Sampler using groovy as a language for example.
Currently JMeter cannot kick off any extra threads to simulate the behaviour so the options are in:
Write your custom sampler which will kick off several parallel threads from JMeter Thread
Use scripting-enabled sampler like Beanshell Sampler or JSR223 Sampler
See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for more detailed explanation and some reference code for points 1 and 2

Resources