How to use Steeping thread group with runtime controller - jmeter

I am trying to use a steeping thread group with a runtime controller
Script flow
login 400 times
Business Flow -Runtime controller for execution Transaction for the time period like 1 hour
logout 400 times
Now Test scenario
All Vuser 1 every 05 second
duration 1 hour
Stop Vuser 1 every 5 second
Steeping thread group I have given a 1-hour duration and in runtime controller also I have given an hour duration
Issue:
My test run for 1 hour but logout is not happening.
Thanks in Advance.

Stepping Thread Group doesn't know anything about presence of Runtime Controller(s) inside it, when 1 hour ends it tells threads to stop no matter whether they executed "logout" or not.
Personally I would rather:
Configure the Stepping Thread Group to perform the workload pattern:
Put "Login" and "Logout" under Once Only Controllers
Put the "Business Flow" under the While Controller with the following condition:
${__groovy((vars.get('TESTSTART.MS') as long) < (vars.get('TESTSTART.MS') as long) + 2000000 + 3600000,)}
So it will execute the "Business Flow" for ramp-up period plus 1 hour and then proceed further
Test plan outline:

Related

Duration Based Apache JMeter Scenario

am running test in duration based scenario with jmeter 5.4.1, at the end of the script, test is getting stop prematurely without executing some of the calls in the last iteration, please help me to make sure all the calls executed in the last iteration, i have tried loop,duration controller nothing seems. to be prominent
Example: i have home, login, search,select item & logout, duration of 5 min with 1 user
Test execution : Home 10 login 10 search 9 select item 9 logout 9
Test execution : Home 10
login 10
search 9
select item 9
logout 9
If you set duration in the Thread Group or in Runtime Controller it doesn't guarantee that all Sampler will be executed equal number of times, when the duration is reached or exceeded JMeter will start shutting down the threads (virtual users) and the total number of sample results will mainly depend on the application response time.
So if you want to execute everything 10 times only - set number of loops in the Thread Group to 10 and either increase or remove the duration.
Alternatively you can use Concurrency Thread Group configured like:
this way 1 user will execute samplers for 5 minutes as fast as it can but not more than 10 times.

Runtime Controller in Jmeter

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.

How to delay my each thread group in JMeter (without using startup delay)

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

How can I make the test to stop (like gradual exiting) the remaining transactions when we hit the 1 hour mark before stopping the test completely?

My test plan is as follows:
Thread Group
Transaction Controller 1
Transaction Controller 2
Run time Controller
Transaction Controller 3
Transaction Controller 4
Transaction Controller 5
Transaction Controller 6
Controller 1 & 2 (Launch Application and Login) - should happen only once
Run time Controller contains some transactions - this will iterate for a
duration of 1 hour
Controller 6 (Logout) - should happen only once
All samplers are found inside the controllers.
I want to run my test for the duration of 1 hour. The problem is when I set
1 hour for my thread group and 1 hour for my runtime controller, Transaction
Controller 6 does not get executed. It all depends where the test flow has
reached when duration hit 1 hour.
How can I make the test to stop (like gradual exiting) but executes the
remaining transactions when we hit the 1 hour mark before stopping the test
completely?
Is there a controller that will wait for the remaining transactions to
execute before stopping the test even if the duration has reached 1 hour?
Your assistance will be greatly appreciated. Thank You
I think the only way to solve this is to take control of the ramp-down manually.
Change your thread group to loop only once, and remove the duration limit.
Put a BSF PreProcessor with this code under your very first sample:
if (vars.get("start_time") == null) {
vars.put("start_time", Date.now());
}
Replace your runtime controller with a While controller with a condition like this:
${__javaScript(Date.now() < ${start_time} + 1000 * 60 * 60)}
If you want gradual rampdown over, say, 5 minutes, you'll need to do something like this (newlines for clarity)
${__javaScript(
Date.now() < ${start_time} +
1000 * 60 * 60 +
1000 * 60 * 5 * ${__threadNum} / <your total number of threads>
)}
If you also have gradual rampup, you'll need to take that into account as well (or if you want the same rampdown as you had rampup, you can just use the first version).

How to add delay after one full round of jmeter scripts run

My requirement is like this:
1. Run one full round of test using jmeter
2. Wait for 90 secs
3. Restart step1
4. I have to continue step1 and this entire process continues for 4 days.
Can someone help me how to add the delay after all the threads have been executed
Create a thread group with 1 thread with a loop count of forever and and click "scheduler". Set a start time and end time.
Put your tests within the thread.
Add a constant timer after the last test (still within the thread group though) and within thread delay, use 90000. (This converts to 90 seconds)

Resources