In my application, I would like to combine a group of HTTP samplers as one transaction, and have a constant throughput on the group.. ie. when I created a thread group with multiple HTTP samplers and defined a constant throughput timer in the group, I am seeing that it is considering each HTTP sampler separately...
Test Plan
ThreadGroup
----> request 1
-----> request 2
-----> request 3
------> constant Throughoput timer ( 1.0 req per min)
It executes as :
-----> request1
wait 60 secs
------> request 2
wait 60 secs...
----> request 3
...
what I would like
-----request 1
----- request 2
------ request 3
wait 60 secs
----- request 1
---- request 2
----- request 3
wait 60 secs
Depending on what exactly you're trying to achieve:
You can put the requests under the Transaction Controller and tick Generate parent sampler box:
Another option is adding Flow Control Action sampler as the 4th sampler and put the "wait for 60 sec" there
And finally you can put a Constant Timer as a child of the 1st Sampler:
use flow control action at the end of the requests
for better understanding difference between timers & flow control action, please go through this video
https://www.youtube.com/watch?v=miZGLaAq4UQ&t=301s
Related
I need to setup an test with respect to following scenario
Thread Group 1(Stepping thread group) (HTTP request 1 should continue for 5 min, THEN Http request 2 should be picked up for 5 min and finally for http request 3 - i.e 15 min test)
HTTP Request 1
HTTP Request 2
HTTP Request 3
Thread Group 2(Stepping thread group) (HTTP request 4 should continue for 5 min, THEN Http request 5 should be picked up for 5 min and finally for http request 6 - i.e 15 min test)
HTTP Request 4
HTTP Request 5
HTTP Request 6
Thread Group 3(Stepping thread group) (HTTP request 7 should continue for 5 min, THEN Http request 8 should be picked up for 5 min and finally stop - i.e 10 min test)
HTTP Request 7
HTTP Request 8
All of the above thread group should run in parallel as a test plan
How to achieve or setup the above scenario in a testplan
For running thread groups in parallel make sure that on Test Plan level
For running a Sampler for 5 minutes put it under the Runtime Controller
Another option is just moving the requests into separate Thread Groups, if you need to pass any data between them - go for Inter-Thread Communication Plugin
I have one request, which triggers every 5 seconds and maximum for 5 minutes until it gets 200 in response code. So ideally that request executes 12 times in a minute and 60 requests total if it fails everytime.
My problem is how I define those maximum 60 requests.
Here is my configuration
I have taken one While Controller
${__javaScript(parseInt(vars.get("Response_code"))!=200)}
In that while controller this components are there,
While Controller
User Defined Variable (Response_code)
Counter (Starting value: 1, Increment:1, Maximum Value:60)
My HTTP Request
JSR223 PostProcessor (vars.put("Response_code",prev.getResponseCode());)
Constant Throughput Timer (Targer throughput: 12.0)
Where should I have to put condition like if my HTTP request gets success in 3rd attempt go ahead to next request else repeat that request again after 5 seconds till 5 minutes?
I am using jmeter Ver. 5.5
You can amend your While Controller's condition to look like:
${__javaScript((parseInt(vars.get("Response_code"))!=200 && ${counter} < 60),)}
this way it will loop until response code is 200 but not more than 60 times.
Instead of Constant Throughput Timer you can use Flow Control Action sampler to introduce static delay of 5000 ms.
There is no need to have a counter, While Controller exposes a special variable, in your case it will be ${__jm__While Controller For Thumbnail-1 QA1.pdf__idx}
More information: Using the While Controller in JMeter
I want to run 2 day test and I am making use of Thread Group Start time and end time feature.
I am looking for design as shown below :
Thread Group 1 (First day start and end time with date)
--> HTTP Request 1 (Execute for 30 minutes)
--> HTTP Request 2 (Should start after 30 minutes i.e. after first one is terminated)
--> HTTP Request 3 (Should start after 60 minutes i.e. after second one is terminated)
Thread Group 1 (Second day start and end time with date)
--> HTTP Request 1 (Execute for 30 minutes)
--> HTTP Request 2 (Should start after 30 minutes i.e. after first one is terminated)
Thread Group start and end times are absolute, therefore you will be able to execute the test only once without editing it. I would rather recommend sticking to relative times like:
Thread Group, 2 loops
Runtime Controller configured to run for 1800 seconds
HTTP Request 1
Runtime Controller configured to run for 1800 seconds
HTTP Request 2
Runtime Controller configured to run for 1800 seconds
HTTP Request 3
Flow Control Action sampler configured to pause current thread for 86400000 milliseconds (24 hours)
I have a Login transaction where in this there are 10 requests. I have added a Uniform random timer for Login transaction for 2 to 3 seconds. i.e all these 10 request will wait for 3 seconds before sending the request as below.
wait for 3 seconds sends Request1
wait for 3 seconds sends Request2
wait for 3 seconds sends Request3
and so on.
So my question is does Jmeter waits for the response before sending the next request. i.e will Request2 waits for the response or will Request3 is sent after 3 seconds irrespective previous requests response. in this case Request2's response.
Please help in this.
Thanks in Advance,
JMeter will wait for response from previous request prior to sending next request in any case. In normal conditions it would look like:
Request 1
Request 2
Request 3
...
See A Comprehensive Guide to Using JMeter Timers article for more information on how Timers work.
By adding a Timer you create a "sleep" before each request, it will look like:
Sleep 2 - 3 seconds
Request 1
Sleep 2 - 3 seconds
Request 2
Sleep 2 - 3 seconds
Request 3
...
However as per documentation:
Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
So if you have > 1 thread you may run into the situation when different threads are executing requests at the same time (which is the main point of load testing).
I am currently using JMeter to simulate 5 users firing requests every 40 seconds. I have created 100 different requests but after every 40 seconds, each user is firing all 100 requests. I want to make it in such a way that after every 40 seconds, each user only fires 1 request and that request has to be different from the previous request. I would like to know what kind of controller to use (or anything else) to achieve this scenario.
Thanks
Try to use Random Controller.
The simplest way to implement your scenario:
Thread Group
Number of Threads = 5
Loop Count = N
. . .
Random Controller
HTTP Request 001
HTTP Request 002
HTTP Request 003
. . .
. . .
HTTP Request 100
Test Action
Target = Current Thread
Action = Pause
Duration = 40000
. . .
This will iterate 5 threads N times.
Random Controller will RANDOMLY pick up on each step http request from "requests pool" - all the samplers added as children to Random Controller.
Test Action will pause thread for 40 secs.
Updated:
working illustration for above scheme:
Thread Group
Number of Threads = 5
Ramp-Up Period = 0
Loop Count = 10
Constant Timer
Thread Delay (in ms) = 40000
You can download working example for described scheme from here: rc-plan.jmx.
This one works how you want (at least for me, Jmeter 2.5.1): it picks randomly ONE request from requests pool (in example - 10 requests) for EACH user (here - 5 users) on EACH step (here - 10 loops) and pauses each thread for 40 secs (Constant Timer).
You can also look into this mailing archive: Is their a way to randomize URL selection?.
Situation similar to your one seems to be described here.
...As per official documentation "Interactions between multiple controllers can yield complex behavior. This is particularly true of the Random Controller."
Another option for you may be to create a CSV file with parameters for your requests ahead of time and use CSV Data Set Config to parameterize a single http request.
That obviously depends on how different your http requests are, but if it fits your requirements there are some potential bonuses with maintaining 1 http request in your test plan vs. 100.
The other details would be the same as #Alies Belik laid out -- one thread group configured for your required number of threads and loops, with a constant timer at the end for your 40 second pause.