This may sound like a duplicate question but its nit, I've searched a lot before putting this here.
I have a single thread group with 10 users and 28 HTTP requests, what I want is something like:
Thread 1 --->rqst 1
Thread 1 --->rqst 2
Thread 1 --->rqst 3
.
.
Thread 2 --->rqst 1
Thread 2 --->rqst 2
Thread 2 --->rqst 3
.
.
Thread n --->rqst n
delay one minute
Start over again.
I tried using constant timer in the thread group but what i got was execution of a single request by all threads every time.
Can anyone please explain how this can be achieved.
There are at least 2 options:
Add Test Action Sampler after all requests and configure it like:
Target: All Threads
Action: Pause
Duration: 60000
Add Constant Timer as a child of rqst 1. Timers are executed before sampler so only one request will be impacted. See A Comprehensive Guide to Using JMeter Timers for more details on timers scope and detailed explanation of each and every Timer.
In both cases delay won't be included into test results
Add a beanshell timer after the last request with something like this
if (${__threadNum} == 10){
Integer WaitTime = Integer.parseInt(vars.get("WaitTime"));
return WaitTime;
}
If the last thread has started add a sleep with milliseconds from the var WaitTime.
Or take a loop at the jp#gc - Stepping Thread Group plugin.
Related
I have 1 thread Group, Within that I have 5 HTTP Request calls. 1st HTTP Request returns a value & that value is used in rest 4 HTTP Requests. The Thread Group Set Up with Number of Thread (Users) : 7 & Ramp-Up period : 5 & Loop Count : infinite. When I run the thread group it breaks due to concurrency.
Example:
When User Thread 1 executes -> Request 1,
Thread 2 executes -> Request 2 (It expects a value from Request 1, Which has not happened for thread 2, Hence it breaks).
Please find the Jmeter SetUp Images below,
Thread
HttpCookieManager
I am new to Jmeter please help me in this.
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers
JMeter Variables are local for the thread (virtual user)
So there is no option that Thread 1 executes Sampler 1 and Thread 2 executes Sampler 2, all users will be executing all Samplers sequentially, it can be checked using __threadNum() function:
So my expectation is that either your extractor fails or Sampler 1 execution by Thread 2 fails somewhere somehow, check the requests and responses using View Results Tree listener, the JMeter Variables using Debug Sampler and jmeter.log file for any suspicious entries.
Objective:
I have csv files with unique data e.g say 200 lines. I want to run endurance test, which executed for duration e.g 10min and avail a unique data from csv.
Setup:
Conisdering this, i did stepping thread setup as below with "shared mode: All threads". And i was expecting each min/60sec, 20 new threads will add and so on till 10min (expecting 200 threads at the end). With Stop thread EOF- True ( want to process data once no dup) and Recycle of EOF= False.
However,API executed in one min only and csv data read by few threads < 20 and done (EOF encounter), though jmeter honoring next 9min without executing my API's.
Expectation : 200 threads will read 200 lines i.e each thread 1 line and occurance of thread will be 20 threads in 60sec. Same like diagram, without doing Stop thread EOF=false. In nutshell, each thread execute once and then stop like kind of stuff.
Any sugeestion, how could i acheive this? Thanks!!
Given your setup each thread will read next line from the CSV file on each iteration
For example:
Thread 1 starts
Thread 1 reads line 1 from CSV
Thread 1 executes 1st sampler, response time is 1 second
Thread 1 executes 2nd sampler, response time is 2 seconds
Thread 1 starts 2nd iteration
Thread 1 reads line 2 from CSV
etc.
So you either need to switch to the Thread Group implementation which has Threads iterations limit setting like Concurrency Thread Group or Arrivals Thread Group or Free-Form Arrivals Thread Group
If you want to continue with your Stepping Thread Group - you need to slow down your threads using Timers
Can you help me to explain relationship between time in Runtime Controller and Ramp_up period value of Thread group?
I tested
Number of Thread: 1
Ramp_Up Period: 1
Loop count: 1
Runtime Controller: 5s
->Elapsed time of current running test: 5s
But with case
Number of Thread: 5
Ramp_Up Period: 5
Loop count: 1
Runtime Controller: 5s
->Elapsed time of current running test: 10s
I don't understand why it become 10s.
Could you help me to explain more?
Ramp up is the time to execute all threads, runtime is controlling each thread execution.
In your case, ramp up 5 seconds means last thread will be executed after 5 seconds. Last thread will enter runtime controller which will run 5 seconds of execution. Thus 10 seconds is the maximum of your execution.
Runtime Controller acts according to JMeter Scoping Rules so it defines how long its children are allowed to run.
Normally you should be using it in conjunction with Loop Count = Forever or -1 on either Thread Group or Loop Controller level.
So
if you want the whole test to run for 5 seconds - use "Scheduler" section of the Thread Group
if you want only certain sampler(s) to run for 5 seconds - put them under the Runtime Controller, however the whole test duration will depend on when the last sampler enters the Runtime Controller
Also be aware that JMeter "asks" threads to stop so it might take some extra time to let them gracefully shut down.
Here I have 4 Thread Groups present in my Test Plan and I have a requirement, need to run test plan in the time interval of 30 minutes between each of my Thread Group (2nd thread group should start only after 30 minutes, after the completion of 1st thread group and so on).
But cannot estimate the actual duration for all my thread groups. And my Ramp-up period should be 0 for all my thread groups, is there any solution to full fill my requirement ?
Thanks in advance
Add Test Action Sampler to the end of each Thread Group
Configure it as follows:
Target: Current Thread
Action: Pause
Duration: 1800000
Add a Synchronizing Timer as a child of the Test Action sampler and set Number of Simultaneous Users to Group by to be equal to number of threads in the current Thread Group
This way Test Action sampler will act as a "rendezvous point" so all threads in the current Thread Group will sleep for 1800000 milliseconds (1800 seconds == 30 minutes), this way you will get a 30 minutes delay between Thread Groups.
Adding to #Dmitri T answer, Make sure in Test Plan the uncheck Run Thread Groups Consecutively so it won't try to execute in parallel
You can add Critical Section Controller in each Thread Group as the parent of all other components with same name (default is global_lock)
That way no Thread Group will start until previous thread ends.
EDIT
For getting result between threads:
Add to each thread group Generate Summary Results to get the result of each thread
Generates a summary of the test run so far to the log file and/or standard output.
I use like this :
Add "Flow Control Action" steps in Sampler List to the end of the Thread Groups
I am doing Jmeter testing. My setup is:
thread group: 1
threads in group: 10
loop count: 5
I also have a csv data config file that contains:
usr1, passwd1
usr2, passwd2
usr3, passwd3
usr4, passwd4
usr5, passwd5
'Recycle on EOF' set to true, 'Stop Thread on EOF' set to false.
Then I read some article online (JMeter CSV Dataset Config: how to move through variables in the same thread?)
A couple of doubts:
I think by setting 'Recycle on EOF' set to true, thread 1-5 will use username/passwd 1-5, thread 6-10 should reuse username/passwd 1-5. But I am wrong, thread 6-10 only get EOF as username/passwd and fail my test obviously, like the article suggest. But why?
Then I set 'threads in group' to 5, problem in 1) is gone, thread 1-5 use username/passwd 1-5 for loop 1. But because loop count>1, I do not know when thread 1-5 finish their 1st round, what username/passwd they will pick for loop 2? Should thread 1-5 still use username/passwd 1-5 in that order always? My observation is that it's like a first come, first served thing, whichever thread finish loop 1 first will get username/passwd 1. Is that the expected behavior?
For some reason, my test does not allow 2 threads to run using the same username/passwd at the same time. If what I describe in 2) is true, then I can have below timing situation:
a) thread 1 (use username/passwd 1)takes longest time
b) thread 5 (use username/passwd 5)takes shortest time
c) when thread 5 finish loop 1, it grab username/passwd 1 and run, at this moment, thread 1 loop 1 is still in progress, bad things happen...
So what configuration can I set to have all threads to wait for each other to finish the current loop, then start to run next loop together?