Logic Controllers
Logic Controllers are the Test Plan elements that are used to customize the order of processing of Samplers and other elements added as child. Primarily, Logic Controllers are used with Sampler requests to perform various customization like - altering their order of processing, grouping them as a single transaction or running the requests in loop etc.
Steps to launch a Logic Controller-
step1 : Right Click on Thread Group
step 2: Hover over Add -> Hover Over Logic Controllers
step 3: Click on the required Logic Controllers
you can also refer the following screenshot
what is the need of logic controllers in jmeter is Performance test scripts are used to simulate the actions of real users. Just like a real user will perform multiple actions in different fashion like perform a set of operations sequentially(e.g. navigate from login page to home page), perform similar types of operations in a loop(e.g. reading multiple unread mails), perform some random operations etc. For simulating these different types of actions, JMeter provides us different types of Logic Controllers which customize the element processing inside them.
Critical Section Controller
This is a newly added controller in JMeter. It ensures that the child elements of this controller are accessed by only one thread at a time.
ForEach Controller
This controller is used to perform the requests in loop, based on the values of a set of related variables.
If Controller
Using If Controller, we can specify a condition whether the child element inside it will run or not based on a condition which should evaluate to true or false.
Include Controller
The Include Controller can be used to provide modularity in JMeter. Using this controller we can add an external .jmx file(a test fragment) to our existing script by loading the jmx file in the Include Controler's control panel.
Interleave Controller
Interleave Controller allow us to pick and execute a single child element out of multiple child in each loop iteration. For example- if we have three samplers added as child to an Interleave Controller than the in first iteration it will pick the first sampler request, in next iteration it will pick the next one and so on. Once the child elements are over, it again starts iteration from first element.
Loop Controller
It allows to execute the operations specified as child elements in a loop with iteration value specified in its control panel.
Module Controller
Using Module Controller, we can reuse a test fragment(e.g. a sampler) into our script again by selecting the module from the Module Controller's control panel.
Once Only Controller
The once only controller is used in situation where we would like to perform an operation only once even if the operation is executed in a loop.
Random Controller
It is similar to random controller and picks a single child element in each iteration but unlike Interleave controller it picks the child element randomly.
Random Order Controller
The Random Order controller is used to execute each of its child element at most once in a random order.
Recording Controller
This controller acts as a placeholder where the scripts recorded using HTTP Proxy Server are recorded by default.
Runtime Controller
Runtime controller is used to limit the time of execution of its child elements. For example, if we have specified the value of 'Runtime' as 100 seconds then the elements inside the Runtime controller will run for 100 seconds with as much iteration as possible.
Simple Controller
This controller is just a placeholder for grouping and ordering the different elements of test plan.
Switch Controller
This controller is used to pick one element for processing out of its multiple child elements. The element are picked not in sequential order or random order instead it is based on a switch value defined in its control panel. The switch value can be an variable with value evaluated to its index(position) of the element or name of the element. For example, if in first iteration the switch value is evaluated to '3' then the fourth element is picked for processing(index value starts from 0). Similarly, if switch value is evaluated to an element's name then that element is picked for processing.
Throughput Controller
The Throughput Controller is used to control the processing of its child elements in terms of the total number of executions or the percentage of execution specififed in its control panel.
Transaction Controller
The Transaction Controller is one of the widely used controller in JMeter scripts. It is used to group multiple sampler requests into one. The response time and other performance metrics of the test result are evaluated for the whole transaction. For example - while checking performance of home page of an application, we can notice that launching the home page generates numerous requests at the backend. Hence, this requires grouping all these request into one transaction, for this we have transaction controller in JMeter. Once we run the script, we can find the overall response time of the whole transaction.
While Controller
The While controller is used to run the child elements inside it till the value specified in its control panel is evaluated to false.
No comments:
Post a Comment