Jmeter - wait for a specific response and collect total response time - performance

our application is testing file upload and I'm curious if I can make Jmeter wait for a specific response and then report collective time.
What I have now is:
whileLoop()
-- HTTP Sampler
-- JSON Extractor
JSON Extracor pulls out a specific field and if it's not null then the loop stops.
The problem is that JMeter doesn't report response time as a sum of all the responses (response times) it had to make and that is what I'm looking for. Is there a way to implement this?

You can put this code inside a Transaction Controller .
You should get what you want.

Related

In Jmeter getting a blank/null response for maximum of the samplers, how can I overcome it?

I have a script in which I have 30 to 40 http samplers and say for sampler number 10 I'm getting like 80% samplers response as blank or null, due to which rest of the samplers below it are also getting impacted as the result of variable not getting extracted in the post processor.
The response time at the 90th% for the 10th sampler is around 25sec.
I want to know is there any thing which I can do in the script to avoid this blank issue or is it something which app server is sending as the result of not able to bear the load.
Will changing the response timeout in the HTTP request default to higher value say 5 Min will resolve the issue?
Please help
Thanks.
You might be interested in Extractor Success Assertion plugin which checks whether the variable(s) declared in the PostProcessor(s) still have(s) default value(s) and if nothing has been extracted - it fails the relevant Sampler.
So you could use any other "Action to be taken after a Sampler error" than Continue in your Thread Group to decide whether you want to start new iteration or stop the thread/test when the response is blank.
Extractor Success Assertion plugin can be installed (and kept up-to-date) using JMeter Plugins Manager

How to get body message from every failed sampler in JMeter thread group

I am new to jMeter so hope you can help me out.
I have a thread group with several HTTP request samplers. I am sending an email every time any sampler fails. The thing is I would like to collect the names + response bodies of the several failed samplers to send in the email.
Can anybody please give an example of how to do it?
The best solution would be using Simple Data Writer listener configured to save only failed requests, there you can choose whatever metrics you need to store:
Another option is using JSR223 test elements and Groovy language to extract the "interesting" fields from the failed requests:
in the above example the sampler gets the label and the body from the previous result and stores them into ${requestName} and ${responseData} JMeter Variables which you can use wherever you want. More information on these prev, vars and other JMeter API shorthands: Top 8 JMeter Java Classes You Should Be Using with Groovy

JMeter load test async api

I make a post call to an api, and don't need to log the response (post to google cloud pubsub), but after that i need to measure time it takes for the data to be processed and appear in another GET request (need to keep hitting it unless the response changes).
I also need to measure the performance under load. I tried JMeter but could not figure out a way to get what I wanted. Is there a way to do this in Jmeter? or some other tool that will let me do what i want
You can put your "another GET request" under a While Controller so JMeter will keep sending this request unless it will match some defined condition
You can put the whole sequence of requests under the Transaction Controller - this way JMeter will measure end-to-end duration of the whole scenario

Jmeter, delay http request with many extracted urls

i have a issue with to many calls to the server.
I have extracted several urls with the "regex extractor".
In the next step, a "http request" calls these urls by ${extractet-urls}
But all requests after the 8th url gets a error 500 response from the server.
I tried to input several timers between, before and everywhere else, but it hasn't an impact.
So my question is:
how can i delay in this single http request which calls all the extracted urls?
Thanks for your help :)
After the requeat you can add sampler ->Java Request. Then change classname to SleepTest and it'll wait 1 second (configurable)
Add a Constant Timer as a child of the HTTP Request sampler (see Scoping Rules for details) and provide desired delay there (in milliseconds). It will cause the relevant thread to "sleep" for the defined amount of milliseconds before executing the HTTP Request. See A Comprehensive Guide to Using JMeter Timers to learn more about using Timers in JMeter tests.
Another option could be using Test Action sampler to create a delay, it doesn't generate sample result so you won't see it in .jtl results file.
The final approach is depending on what you're trying to achieve and how your test is designed.
Alternatively, you can add a Thread Group and define a ramp up time, then put the request inside this group. The ramp up time takes the startup overload too.

How to measure the Test Fragment response time in jMeter?

My jMeter script performs visiting the Workout history page of the website.
While leading there the app sends 8 api requests. We put them into one Test Fragment but while running scripts in jMeter I get the response time of each HTTP Request.
Is there any possibility to get the response time of the whole Test Fragment?
My Test Fragment screenshot
It is simple. You just add a Transaction Controller in the Test Fragment. Move all the HTTP requests under the Transaction Controller.
If you are looking for only the total time of all the requests, then check the Generate parent sample checkbox.
you could definitely do this in beanshell, start a timer and then calculate the end time.
Also you might try something like the JC#gc package of extra plugins for something like responses over time.

Resources