What is the difference between Random Controller and Random order controller? - jmeter

Please, anyone of you, clear my doubt with a simple example for my above question?

Random Order Controller plays all Samplers that are its children but in a random order
Random Controller plays only one of its children samples picking it randomly
Reference documentation is here:
https://jmeter.apache.org/usermanual/component_reference.html#Random_Controller
https://jmeter.apache.org/usermanual/component_reference.html#Random_Order_Controller

Random Controller: It will pick one sampler/request at random from all those added under it and executes it. Like: if you have 10 HTTP requests samplers under a random controller then this controller will execute only 1 of them, randomly.
Random order controller: It will pick all samplers placed under it, but in a random order. Like: If you have 10 HTTP request samplers under a random order controller then this controller will execute ALL of them, but in a random order each time.

Related

JMeter - 50% split and take relevant path

I am not an expert in JMeter but hope you can help.
How does one execute a test plan where based on a CSV input of users, I want 50% of them to go down 1 flow (for each user - do stuff) and the other 50% to do another flow of logic?
I'm not fussed about if it's at random (That would be good) of users in the file or sequentially going through it and splitting at the 50% mark - but do want to know how to do this type of process within a test plan?
I am trying to create an even (or almost even) type of distribution "load" - some go one path, some go another path. Simple.
Let me give you a walk through:
we have students.
students have different tests.
half of them I want each student to do ALL tests
half of them I want each student to do 1 test (based on some JSON that has been parsed which gives us the list of tests from the web end)
Also, is it possible where if I have a jmx file that contains, say, 10 controllers (these would be tests), I can pick one at random and then return back to the parent? Maybe in here a decision can be made to do next test or not and if next test then... cycle to the next one
Thoughts?
I am using JMeter 5.3 if it helps!
You can use Throughput Controller(s) to distribute the executions.
Set the Based on to Percent executions and set the value to 50.
Note: Set the Sharing mode in the CSV Data Set Config appropriately
You can use a Random Controller to pick a random child from the sub-controllers and samplers.
Use modulo (%) operator on the studentID (or 'number' or 'rownumber' -- whatever is handy).
If the output is odd, send a request to scenario a (first 50%), and if even, send a request for scenario b (second 50%).
// Example in PsuedoJava:
int id = myStudentIDNumber;
if(id % 2 == 0){ // Remainder is 0, so even number
fetch(mywebsite/api1);
} else { // Remainder is 1, so odd number
fetch(mywebsite/api2);
}
There are multiple ways of implementing your scenario, depending on what is your design the options are in:
Throughput Controller which controls how often its children to be executed (either in percentage of total executions or in absolute values)
Switch Controller which acts like a switch statement in programming languages - this guy seems to be the most appropriate for your use case. Moreover it can run a random child if you supply __Random() function as the input
Weighted Switch Controller - which combines above 2 approaches and provides easy way of

Execute requests from the scenario in random order [Taurus/JMeter]

I have a pretty big load test scenario for execution that I want to run with Taurus. It has more than 1000 different requests - some of them in loops because I would like them to execute several times.
Now that I have the scenario completed I'm looking for a way to randomise the requests during the execution. For example instead of the Taurus running the tests line by line from the scenario I would like Taurus to execute requests from the scenario in random order.
Any ideas how this can be achieved?
You can add to JMeter test plan Random Controller
Random Logic Controller acts similarly to the Interleave Controller, except that instead of going in order through its sub-controllers and samplers, it picks one at random at each pass.
You can even set 1 request at a time
ignore sub-controller blocks If checked, the interleave controller will treat sub-controllers like single request elements and only allow one request per controller at a time.

How can i execute several scenarios simultaneously without using several thread groups

I have created seven thread groups which execute different scenarios in one application. I'm trying to optimize my scripts in order to be more maintainable and easy to master when someone else uses them.
The thing that i cannot figure out is how can i combine those thread groups into one or two and to still have the seven different execution paths and the possibility to control them, by control i mean to set how many users to execute scenario 1, how many to execute scenario 2 etc. till 7.
Currently the test plan looks like this
If you don't want several thread groups for some reason the alternative options are in:
Throughput Controller - with different global executions or execution percentages
Switch Controller - which provides random weighted values (in some cases Throughput Controller doesn't guarantee that samplers in scope will ever be executed)
See Running JMeter Samplers with Defined Percentage Probability guide for more information on configuration and implementation.
Well i just figured out how to do that i have added a Loop controller a Random Order Controller as child of the loop controller. And i have put seven throughput controllers as child of the Random Order Controller so now everything looks fine

Loop interleave controller

I am trying to use the interleave controller inside another controller (ForEach OR Loop OR any other) such that each of the sampler (which is HTTP request) under Interleave controller is executed once and the test exits the "outer" controller once the last sampler is done.
My test plan looks somewhat like show below
test plan
--Loop controller ( with loop count = num of requests in Interleave Controller)
----Some test elements
----Interleave Controller
--------HTTP requests (count = n, with some differences)
----Some More test elements
The test plan is to test multiple test scenarios of a lot of REST services (having some changes in the request data etc) so some services might have 2 scenarios some might have 10.
Thus is there any way of getting the number of samplers under the interleave controller ? OR a better design to my test plan.
Thanks
Have a look at the interleave documentation as it explains nicely how it works and how one sampler, going from top to bottom, is executed per iteration. If you want only one sampler executed randomly (per iteration) you can use the random controller.
Note: Those controllers don't stop by them selves if all children have been executed. They start all over again. If you want to stop you have to add different logic to make that happen.

Test concurrent users with different browsing patterns

So using Jmeter today and whilst I know i can load test a website with concurrent users using threads, loops etc I was wondering if it is possible to setup a test where say 50 users access the website and then each of them browse the site in a different way?
Has anyone done this before or would jmeter not be the tool to use?
Looking for some suggestions or an idea how to do it in Jmeter.
Suppose you have at least the following simple possibility:Random Order Controller.
Implement set of navigation/browsing steps via separate samplers or group of samplers (grouped via e.g. Simple Controller or Transaction Controller - if some steps should be always executed in defined sequence).
This will be "pool" of navigation steps.
Adding all these steps as child samplers to the Random Order Controller let you have different, per user, randomly generated sequence of navigation steps.
In this case you possible have to put your login/logout samplers (if any) out from Random Order Controller. As well you can e.g. use both scenarios with and without login/logout, etc.
Thread Group
...
Login Sampler
Random Order Controller
Sampler A
Sampler B
...
Sampler X
Logout Sampler
...
As well you can also additionally look onto
Random Controller
Switch Controller: e.g. define in csv-file per-user navigation scenarios, read these scenarios during script execution and assign extracted actions to each thread;
Include Controller.

Resources