How to run a thread group for a given number of times, eg. 10,000 times.
You can use Loop Controller where number of iterations are in your control (you can define) instead of scheduled time (there is no control over no. of iterations, once time is completed, JMeter stops the test). So, I suggest using Loop Controller.
When you ran the test for 5 mins, it might be the reason that scheduled time got completed so stopped the test, hence next 2 requests are not sent.
Add View Results Tree listener and observe the behaviour. Once debugging is done, remove the listener as it consumes a lot of resources.
Related
I need write the following scenario in JMeter
Login via http request and in parallel sending calls for 8 hours.
After that running in parallel Login and Logoff and sending calls again for 8 hours
After that running in parallel Login and Logoff and sending calls again for 8 hours
After that running in parallel Login and Logoff and sending calls again for 8 hours
and after N runs … start everything from beginning.
I created N thread groups , and added parallel controller , and under the parallel controller i added the loop controller of Login , Logout, sending calls
it didn't worked , the test stops after running the first run of thread group, it doesn't run as duration time .
what i m doing wrong , maybe i have to write the test plan different?
We cannot say anything meaningful without seeing your Thread Group configuration, for now I can only state that your test will end when:
the last user finishes the last iteration specified in the Loop Count
the test duration exceeds the "Duration"
whatever comes the first.
So make sure to tick "Infinite" box and specify the desired duration of your test plan
Also be aware that according to the How to Use the Parallel Controller in JMeter the Parallel Controller runs its children in parallel. Once. The main use case for the parallel controller is simulating AJAX requests to bypass JMeter's limitation of "one virtual user = one thread", maybe for your test scenario it makes sense to increase the number of threads in the Thread Group instead of going for Parallel Controller.
And last but not the least, be aware of the Runtime Controller which executes its children for the specified duration.
i have the need to run one http request sample more times than the rest of the samples in the Test group, for example, i need to run for 10 users, but for each of them, i need to run one of the samples multiple times, lets say 10, is there a way to achieve it?
1) I set "Number of Threads (Users)" in Thread group to 10, so i have 10 total users (with data taken for every thread from a CVS file, with equal number of rows and threads, so 1 thread is an unique data set.
2) I make some requests after, but for only one of the requests, i need to make it like 100 times in parallel for the same data for every thread, so in total, i will make 1000 (100 http requests for 10 unique users/threads) requests to that endpoint
Thanks in advance!
Edit: I found the loop controller, but its not making the 100 http requests at the same time for each thread in the thread group, it makes another one when the first ends
If I correctly got your requirements, to wit:
You need to execute one sampler more times than other samplers
The execution must occur at exactly the same moment
The most obvious choice would be either Parallel Sampler or Parallel Controller (depending on the nature of your requests). You can install both test elements using JMeter Plugins Manager:
My test is configured like below.
Thread group is configured to run for 9600s which is 160 mins that is 2 hours 50 mins.
within that I have placed constant timer as 1800000(ms) as that parameter is to be provided in ms. when I start the test, it stops within 4 mins and I can see in log that:
Stop test detected by thread:...
Is there any limit for constant timer, I.E. what could be the reason my test is stopping after 4 mins ?
There is no such limitation on Constant Timer. The error could be because of some other reason.
Share the error message and other configuration details in Thread Group. Also share View Results Tree screen shot after running the test
Note: Test will stop automatically if Jmeter completes with script execution irrespective of the time mentioned in scheduler. so, you should provide enough loop count (or mark forever), so that test would run till the scheduled time completes.
I'm trying to run a scenario that ramps up each thread by logging them in once, loops through an business action for an hour with pacing, and logouts as it ramps down.
Ideally the threads should not log out all at once, as such it I wanted to find a way to execute a logout action for each thread ramping down.
I have tried using stepping and ultimate thread groups, however for ramp down, the threads are being stopped.
In addition, I have tried the following scenario: 1) login, 2)runtime controller scheduled for one hour with the business action, 3) logout. This however, results in premature aborts for the threads that are still executing the business action once it reaches one hour.
Any help, even implementing this in beanshell, would be greatly appreciated.
You can just use a TearDown Threadgroup. That will always be executed once your test is over.
You can use a thread group which sets a jmeter property, let's call the property "isRunning", in a pre or post processor, next that thread has a test action set to pause for the duration of the test. After the pause set the property "isRunning" to false.
When the user logs on in another thread group (your test case) grab the "isRunning" property and store the value in a jmeter variable for the thread. Once the user logs in put your business case in a while loop with the jmeter variable created using the "isRunning" property as the condtion.
Get the value of the "isRunning" property somewhere towards the end of your business case and update your jmeter variable. Put the log out controller outside of the while loop. When the first thread group sets the "isRunning" to false, the while loop in your other threads will finish executing the use case and log out when it sees that the while condition is no longer met.
If you use any type of random think timers and ramp time, the threads should essentially step down on their own, due to ramp time offsetting the start of the use case and random think times.
Not sure if this is the best way to go about this, but I needed to do the same thing you are looking for and this proved to be a feasible workaround.
I've got a pretty basic test plan in JMeter consisting of a Thread Group and a bunch of HTTP Requests separated by Timers and a Summary Report. I notice when I watch the report that all 10 of my threads make the first request, then pause for some time, then all make the second request.
Is it possible to have each thread execute the full script independently of the others so that (given a Ramp-up delay) you have overlapping workload, i.e. some threads executing the first step while others are on the 3rd or 4th etc?
Threads DO execute independently in JMeter.
Make sure you are you using any Ramp-up period in the thread group definition.
Another reason for what you're seeing is probably due to using a constant timer which ends up in requests looking they they are synchronized. If you simply change it to one of the Random timers you'll get more randomness in the delay between requests.
Here are two good sources about timers:
http://performancetestersdiary.wordpress.com/2013/03/06/jmeter-timers-in-pictures/
http://www.softwaretestingclass.com/timers-in-jmeter-tutorial-series-6/
Yes, Threads DO execute independently in JMeter, but,if you start at the same time and do the same things, all the requests will be issued at the same time (specially if you are using a constant throughput timer).
I use two way of approaching this problem:
use a uniform random timer under a "once Only controller", at the beginning of the thread.
The value of the timer should be close equal or close to the time it takes to execute the service.
use rampup time (same value as above). It is deterministic and simpler to use (which can be bad or good, according to your needs.
Click on your "Test Plan"
Check/Select the Property: Run Threads consecutively (i.e. Run Groups one at a time)
Hope this will help.