How can we calculate the time until expected API response is received? - jmeter

Using Jmeter, I have the bellow scenario:
Make a POST Request to an API - This request make a deployment request and takes ~1 second to get a response that request has been made
Make a GET Request to an API - This request check if the deployment is completed. The response looks like {"Completed": true}
I need to calculate how long it takes from sending the POST response to the GET response returning true (trigger until it says true)
Is there a way to do it in Jmeter?

Put your GET request under the While Controller and use __jexl3() function to check the "Completed" status variable value
Add JSON Extractor to the GET request to extract the status into a JMeter Variable
Put everything under Transaction Controller to measure the cumulative time

Related

How can I send the second set of loop after getting response of the first set of loop in Jmeter

My application is calling ajax in every 5 seconds. I am testing with a load of 3500 users. That means 3500 users are calling ajax in every 5 seconds
Application setup- ajax is called in an interval of 5 seconds only after getting a response from the first ajax. Mean first ajax is called the request is processed by server and give response and then 5 seconds and then next ajax is called.
My jmeter setup- Am using loop controller and constant timer(5 seconds) inside the loop controller. So the request is being send my jmeter constanly in every 5 seconds irrespective of the response. So every 5 seconds 3500 users is being called with or without getting response.
My expectation: I want to call ajax request only once I gets the response from each threads of 3500 users. How can I do that in Jmeter.
One possible way is to use a "IF Controller" in Jmeter to check the response of the previous request and control the rest of the flow accordingly.
For example, use ${JMeterThread.last_sample_ok} function as the condition of the controller, which checks if the previous request was successful before executing the next request.
More information can be found under "Tip #5 - Use the ${JMeterThread.last_sample_ok} to Check Transactional Requests" in [1]
[1] https://www.blazemeter.com/blog/six-tips-for-jmeter-if-controller-usage
Hope this helps.
Thanks for the prompt reply. This actually worked. But, I found out much simple method. Added a beanshell postprocessor as a child of the ajax request and added a script Thread.sleep(5000);. Which did the same behavior I explained above

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

Calculate the time for Sync in Two micro service using Jmeter

I have Scripts Two API:
Post API
Get API
I need to calculate The time have to sync between First API and Second API and Calculate the Time its take to sync , In simply way I need to hit the Get API until I get Success response and Calculate the time for all these request Until Success for These hits , is there a way to do that using Jmeter ?
Organize your Test Plan as follows:
Transaction Controller - to measure the duration of the whole requests sequence
While Controller - to loop the "First API" unless you get Success
Post API
PostProcessor - to get "success" criteria
Get API

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

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.

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