I have 5 thread groups (Ultimate Thread Group) in JMeter. When I run the entire test, the samples in the first thread group work fine, those in the second thread group invoke the web sites timeout page, but when the same samples (in the second thread group) are put in the first thread group and the test run, they work fine and do not invoke the timeout page. I realise that I need to pass the session from the first thread group to the other thread groups, please how do I do this?
The following is the cookie data:-
The following are the thread groups:-
If you need to pass data between different Thread Groups most probably your test is badly designed.
Each JMeter thread (virtual user) must represent a real user with all its stuff (Cookies, Cache, Headers, think times, etc). If these 5 business actions are a part of a single used workflow - they need to be put under the same thread group.
Use different thread groups to represent different groups of business users.
If you really need to pass cookies between thread groups it can be done using JSR223 Scripting or Inter-Thread Communication Plugin
Related
I'm looking at doing spike tests and I think ultimate thread groups in Jmeter are the way, but I need Jmeter to keep the connections open during the test and use same user on each iteration like it does in regular thread groups, is there a way to force that in Ultimate thread groups as well?
If not, is there a way to do spike testing with regular thread groups in Jmeter?
I've tried setting the thread schedule to produce spikes in ultimate thread group but Jmeter continues to generate new connections per each request. In regular thread groups this can be solved by checking "Use same user on each iteration" but that check box is not present in Ultimate Thread Groups.
I can think of the following options:
Don't use Ultimate Thread Group, the "spike" can be implemented using normal Thread Group in combination with Synchronizing Timer
If you want to proceed with the Ultimate Thread Group you can add a Loop Controller to it and set the desired number of iterations there
More information: Stress Testing, Soak Testing and Spike Testing Best Practices with BlazeMeter
I have Thread A that performs user login, setting some settings and creating some records. While working on the records page, there is a background thread, Thread B, that is being called every 15s, performs some sort of sycnronisation, but only when I'm on the records page.
What I managed to do is created a second thread that will fire these requests each 15s. Using a BeanShell PreProcessor I share the cookies between the two threads, so that the Http cookie manager in the second thread uses the same variables/values as the first one. My requests are working fine.
What I can't figure out is how to trigger Thread B when the Thread A has reached the step that involves records. One option is to delay Thread B for a certain amount of time, but this isn't very reliable as I can't know before hand how long it takes Thread A to finish creating the users.
Is there a way to trigger a thread from another thread?
Take a look at Inter-Thread Communication Plugin - it allows synchronizing actions between different threads (even if they are in different thread groups) basing on a simple FIFO queue.
The logic would be:
When you did some action by Thread A put something into the queue using fifoPut function
Thread B will be scanning the queue and if anything comes up it will get the value and start execution of its own actions.
Check out SynchronizationExample.jmx test plan for reference implementation.
You can install Inter-Thread Communication plugin using JMeter Plugins Manager
Also be aware that starting from JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so kindly avoid Beanshell going forward.
I want to run a thread x times. The thread group contains three samplers and because I dont want them to be mixed up in the result windows I only want to start the next thread when another is finished. I don't want to use a Ramp-Up Period because a thread could take 1 to 20 seconds.
You could use 3 thread groups and module controller (to referencd in the 2 other thread groups the elements in the first one to avoid copy ) and check on test plan the option:
Run Thread Group sequentially
Your use case is not very clear, however if you need to limit JMeter to X concurrent threads only the most obvious choice would be going for the Concurrency Thread Group
As per Advanced Load Testing Scenarios with JMeter Part 4 - Stepping Thread Group and Concurrency Thread Group article:
The Concurrency Thread Group provides a better simulation of user behaviour because it lets you control the length of your test more easily, and it creates replacement threads in case a thread finishes in the middle of the process.
You can install Concurrency Thread Group as a part of Custom Threads Group bundle using JMeter Plugins Manager
Regarding your three listeners bit, I would recommend reconsidering this approach as per JMeter Best Practices you should not be using any listeners, instead of it you need to run JMeter in non-GUI mode and use -l command-line argument to specify the results file name. Once your test is finished you can open the .jtl results file with a listener of your choice or generate a reporting dashboard from it.
You can use "jp#gc - Ultimate Thread Group". The Ultimate Thread Group provides flexible thread scheduling to your test scenario. It allows us to create a scheduled thread with advanced configuration. Start Threads Count, Initial Delay, Startup Time and Hold Load Time can be defined separately for each record.
You can define tasks to run consecutively.
This platform support flexible thread scheduling. You can read detailed wiki docs about the ultimate thread group.
Link: Loadium.com/wiki/ultimate thread
I've got quite complex jmeter test plan that prepares data and save pre-conditions to properties that next thread groups use. So I CANNOT disable "Run thread groups consecutively" and split this onto 2 different plans. But I need to emulate different users' behavior and those thread groups differ by Number of threads and queries.
Is there any way to launch selected thread groups sequentially without breaking preparation on a regular basis?
Will try to do that via setUp Thread Groups/ Thread Groups / TearDown Thread Groups and without Run consecutively
I have set up a load test plan with multiple thread group, i.e. -
Registration (50% of the threads)
Place Order (10% of the threads)
Some more operations (remaining threads)
Herein if Registration thread does not succeeds than I don't want to execute remaining thread groups. In case of a single thread group I can use if controller and discard samples if one sample fails but how do I achieve it when I am using multiple thread groups.
JMeter Variables scope is limited to current Thread Group only, if you want to use If Controller basing on the condition which is set in another Thread Group - you should be using JMeter Properties instead (JMeter Properties scope is global for the whole JVM). See How to Use Variables in Different Thread Groups article for details on converting JMeter Variables into JMeter Properties.
You may also find InterThread Communication plugins useful when it comes to passing data between thread groups and setting up dependencies.
However, given your scenario you either need to pass the whole thread context (cookies, cache, whatever) which might be tricky so it would be much better putting all the samplers under the same Thread Group and use Throughput Controller, Switch Controller or Weighted Switch Controller, whatever matches your scenario the closest way. See Running JMeter Samplers with Defined Percentage Probability guide for more information.