Loop interleave controller - jmeter

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.

Related

running 2 samplers consecutively like a bundle in Jmeter

I am trying to ensure that 2 samplers(A&B) in a thread are always ran consecutively like a bundle.
The thread group I wanted to do is:
where the controller makes sampler A&B a bundle and always runs them sequentially/consecutively, and where sampler C,D,E are other samplers in thread group 1.
and the desired results in chronological order should be similar to this:
in a way that no matter in what order the rest of the samplers are ran, B is always ran right after A is ran.
I have tried several controllers:
critical section controller would allow me to run B right after A everytime, however it seems that it cannot work with multiple threads and only works when I give enough ramp up time, and I don't find enough information that makes enough sense on this controller (please correct me if you have a better understanding of critical section controller)
loop controller would run B right after A only if I give enough ramp up time
interleave controller would run B right after A only if the only controller in the thread group
I have also read multiple posts on stackoverflow on this creating a bundle matter, however couldn't find a solution to it.
The samplers in a thread are executed in the order they appear in the tree.
I'm not sure if you want C, D and E to execute randomly in the same thread. If they are independent from A&B you can move them to other threadgroups.
Execution order
If you want to exclude all samples from other threads between A and B, you could try setting a property before A, and resetting it after B.
Also A and B should be in a Critical Section controller.
With an if controller you could check if the property is set, to exclude other samples between A and B.
With only one ThreadGroup I think something like this should work:
TG
Critical Section
sampler A
preprocessor Set X=1
sampler B
postprocessor Set X=0
if X!=1
sampler C
if X!=1
sampler D

Run first request multiple times and other request single time in a single thread

I Have 5 HTTP request in single thread, I want to run first request multiple times and then other request only single time
I can't use multiple thread as all request are depends on each other.
Depending on what you're trying to achieve:
Put the request which needs to be run only once under Once Only Controller, this way the Sampler will be executed only during first iteration of the Thread Group
If you want more complex/flexible criteria - put the request which needs to be executed only once under the If Controller, this way you will be able to specify whatever criteria you want. For example if you want to run a Sampler only during 5th iteration use the following condition:
${__jexl3("${__jm__Thread Group__idx}" == "5",)}
this way the sampler(s) which is (are) under the If Controller will be executed only if the condition is met:
Put first request under Loop Controller with Loop Count as the times you want to repeat
JMeter will loop through them a certain number of times, in addition to the loop value you specified for the Thread Group. For example, if you add one HTTP Request to a Loop Controller with a loop count of two, and configure the Thread Group loop count to three, JMeter will send a total of 2 * 3 = 6 HTTP Requests.
Choose request(s) you want to execute multiple times and then:
Right Click -> Insert Parent -> Logic Controller -> Loop Controller

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.

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.

Interleave controller Issue - JMeter

I am trying to simulate a sequential call to couple of webservices by putting them under Interleave controller. Although I have unchecked "ignore sub-controller blocks", jmeter still runs only one of the controllers living under interleave controller and alternates it for each iteration. What I need is a sequential call to all .
Any help is appreciated. Cheers
The Interleave Controller is running as it should do. It will alternate through one web service for each iteration
If you want a Sequential call to both web services on each request, then just put them directly under the Thread Group - without any logic controller or keep a Simple Controller
Unless I'm misunderstanding your question, why do you need the Interleave Controller?
Jose
Thanks for the answer. Keeping them directly under thread group did not call them sequentially. You can try it. I currently have about 10 webservices (let us call them 1..10) some are heavy and some are light there by resulting in different response times. However, I would like to run these in order that is from 1 to 10.
Directly placing them under thread group did not call them sequentially, so I used interleave controller with "ignore sub-controller blocks" unchecked.

Resources