I need to see the time taken by certain APIs in the test plan in jmeter - time

There are multiple requests in the test plan created for ride booking process. I need to find the time taken between the login and the ride booking apis .Is there a way wherein I can get these details in the test plan automatically without any manual intervention?

Most probably you're looking for the Transaction Controller, it generates synthetic Sample Result with the response time which is the sum of all its children
More information: What is JMeter’s Transaction Controller?

Related

Is there a specific way to achieve the below scenarios in JMeter ? if yes how?

Can someone guide how can I achieve below scenarios via JMeter
1.Check if system is able to process 1,00,000 random searches per hour
2.Check if system can accept 1,00,000 transaction's per minute- this is more like form submissions
First of all you need to implement your test scenarios (search and submitting forms) using HTTP Request samplers
The HTTP Request samplers can be:
Recorded using JMeter's HTTP(S) Test Script Recorder
Recorded using JMeter Chrome Extension
Created manually basing on your application/endpoint specifications
Once you have test project skeleton and perform necessary correlation of dynamic values and parameterization of dynamic parameters like usernames you can start defining the workload, i.e. see Building a Web Test Plan user manual chapter
Add as many virtual users as needed, run your test and see whether your application can handle the anticipated load.
Suggested scenario:
Increase the load gradually, i.e. start with 1 user and increment the number of users till the projected amount
Look at Transactions per Second chart and Active Threads Over Time chart. On well-behaved system the throughput (number of requests per second) should increase as the number of users increase.
If you detect the point when you increase the load but the throughput doesn't increase - it means that the system reached the maximum performance. If it is sufficient - you can report the test as passed, otherwise you will need to investigate the root cause and either report or fix it if you're capable of doing this.

How to Capture Jmeter test metrics like test start time, end time, number of users and pass it to rest API call

I am new to JMeter. I have two scripts one script is web and another is a rest api call which posts metrics to server. Both the scripts are working fine. Now i wanted to implement a scenario.
Web Script should run first once the script is completed i need to capture test metrics like start time, end time, load rate (No.of threads), Pass or fail save to a variable and pass these values to the rest api call which will then run and post the metrics to the server.
Any help is appreciated
Start time - can be obtained as ${TESTSTART.MS} JMeter pre-defined variable
End time - can be obtained via __time() function, if you call it somewhere in tearDown Thread Group it will report the time when all the main Thread Group(s) are done
Number of threads - it's a kind of weird requirement because its you who define the number of virtual users. Anyway, you can obtain it at any moment of time using i.e. __groovy() function like:
${__groovy(ctx.getThreadGroup().getNumberOfThreads(),)} - returns the number of threads which are active currently
${__groovy(ctx.getThreadGroup().getNumThreads(),)} - returns the number of threads which are defined in the Thread Group
As you are planning for the given scenarios you need to do following things.
1) You need to user jp#gc listeners to measure the results in (response time, threads per minute/seconds, hits per second and many more)
You can find the list of listeners here >> https://jmeter-plugins.org/wiki/GraphsGeneratorListener/
2) You need to implement the test plan using regular expression extractor for taking values from the response requests which you can store in the variables and later pass on to the dependent requests. for documentation visit https://jmeter.apache.org/usermanual/regular_expressions.html
For general understanding you can go through the jmeter official documentation
https://jmeter.apache.org/usermanual/get-started.html
I hope it will help you

Is it a good approach to use Transaction controller in JMeter?

We are performing load testing using JMeter, we have to calculate the time taken by each page, but each page has multiple requests. Should we add transaction controller to find out the overall time taken by each page or should we calculate time taken by each sample in JMeter?
Transaction Controller isn't the case,it should be used to group several samplers
Transaction Controller generates an additional sample which measures the overall time taken to perform the nested test elements.

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

Think time between Transaction Controller

I am using Transaction controller for my testing process, and I have 5 transaction controllers. Now I want to specify think time (Timer) between each Transaction controller say 300 ms.
When I add constant timer, then every sampler takes 300ms think time to process and because of this the overall response is increased a bit.
Is there any other way to give think time to only transaction controller and not individually sampler?
You can work it around as follows:
Add a Beanshell Post Processor as a child of the last request in each Transaction Controller
Put the following code into the Post Processor's "Script" area:
Thread.sleep(300L);
Configure Transaction Controller to
generate parent sample
not to include duration of post processors and timers into the generated sample
See Using JMeter's Transaction Controller guide for more detailed explanation.
I could think of 2 options that would provide required solution:
1)The easiest way would be to put the timer to the first request of the following transaction controller.
OR
2) At the end of the Controller add Test Action which can be found under Sampler where you can provide PAUSE time in milliseconds.
Hope this helps.
Add a Test Action and select pause. Set this to 0ms and then add a Gaussian Random timer to the test action. Configuring timers this way will allow you to run the test with pauses or without (for debugging), test actions configured as timers will not be skipped when clicking "Start No Pauses", while the Gaussian timers attached to test actions will.
The best way to do this is via "Add think times to children" on the Recording controller. This will insert a "think time" action between each controller. Then you specify the duration in ms in each Think Time action.
Usually, I would use ${thinkTime} as the duration, then specify thinkTime = 10000 or similar in the "User defined variables" config element you can add to the top of your project.
The think time is between transaction controllers, not between requests in a controller.
I am using jmeter 5.3.

Resources