Today we are concentrating on list of supported Controllers in JMeter.

JMeter in-built function controller is basically a Logic Controller provides control on “when & how” to send a user request to a web server under test. Logic Controller having command of the order of the request sends to the server.

Logic Controllers

Logic Controllers facilitates users to describe the sequence of processing request sends to the server in a Thread like; JMeter’s Random Controllers can be used to send HTTP requests randomly to the server. Logic Controllers define the order in which user request are executed.

Some useful Logic Controllers comes in operation are,

  • Recording Controller
  • Simple Controller
  • Loop Controller
  • Random Controller
  • Module Controller

 

Recording Controller

After recording of testing process happens in JMeter, Recording Controller role is to store those recordings.

Controlers1

Simple Controller

Simple Controller is a container, holds user request. It does not provide any customization, randomization or change of loop count, etc as other logic controllers do.

Loop Controller

Loop Controller creates a situation where user request runs either; for limited time or forever, which is better explained in the figure,

Controlers3

Random Controller

Random Controller creates a situation where user request runs inrandom order in each loop period. Suppose, the websitehttp://www.google.com is having 3 user requests in following order,

  1. HTTP request
  2. FTP request
  3. JDBC request

Each user request runs 5 times i.e,HTTP request runs 5 times, FTP request runs 5 times and JDBC request runs 5 times,means; total user requests send to the Google server is 15 = 5*3 by JMeter.

Controlers4

 

In each loop, user requests send sequentially in following order,

HTTP request -> FTP request-> JDBC request

In each loop, user requests send randomly in following order,

FTP request -> HTTP request-> JDBC request

Or

JDBC request -> FTP request-> HTTP request

 

Module Controller

Module Controller sets the modularity in each module of JMeter function stored in Simple Controller. For example; any web application consists of numbers of functions like; sign – in, sign – out, and account creation, password change, Simple Controller stores these functions as modules then Module Controller chooses which module needs to run.Suppose, simulation happens when 50 users sign-in, 100 users sign-out, and 30 users  search on website www.google.com.

Controlers5

 

Using JMeter, user can create 3 modules where each module simulates each user activity: sign-in, sign-out, and Search. Module controller selects which module wants to run.

 

Some More Vital Controllers

Interleave Controller:  Select only one user request which runs in one particular loop of thread.

Runtime Controller: Determines that till how long its children are permitted to run.For example; if user has detailed Runtime Controller 10 seconds then JMeter will run the test for 10 seconds.

Transaction Controller:Evaluates the overall time taken tocomplete a test execution

Include Controller: It is created to utilize an external test plan. This controller permits you to utilize multiple test plans in JMeter.

 

Brief Look on Loop Controller

Here you will get to know each and every step involved in adding Loop Controller to at present performance test plan.

The Loop Controller helps samplers run at specific number of times with the loop value you definite for the Thread Group. Suppose user, add one HTTP Request to a Loop Controller with a loop count 50, configure the Thread Group loop count to 2, and then JMeter will send a total of 50 * 2 = 100 HTTP Requests. These examples are explained below in better manner,

  • Configuring Thread Group
  • Adding Loop Controller
  • Configuring Loop Controller
  • Add View Result in Table
  • Run the Test

 

First Step: Configuring Thread Group

Add Thread Group:

To add the Thread Group, first run JMeter, from opened interface of JMeter choose Test Plan from the tree and right click to choose Add -> Threads (Users) -> Thread Group.

Controler6

 

After opening thread Group, enter Thread Properties as shown in figure below,

Controlers7

In the above figure, Number of Threads: 1 user is connected to target website, Loop Count: run it 2 times, and Ramp-Up Period: 1.

The Thread Count and The Loop Counts both are different. In the Thread Count, it simulates 1 user trying to connect the targeted website. In the Loop Counts, it simulates 1 user trying to connect the targeted website 2 times.

Add JMeter elements:

Here we will Add HTTP request Default” element.

To get this element, go to Thread Group and right-clicking, from context menu select Add -> Config Element -> HTTP Request Defaults.

Controlers8

In the HTTP Request Defaults page, enter the Website name (www.google.com) under Web server -> Server name or IP.

Controlers9

 

Adding Loop Controller:

To open the Loop Controller pane, right click on Thread Group -> Logic Controller -> Loop Controller.

 

controlers10

 

Second Step: Configuring Loop Controller:

Given below figure shows Loop Count: 50 which means one user request sends to the web server google.com run 50 times.Jmeter with take loop value =2 specified for Thread Group in the above figure to send the total HTTP Requests: 2 * 50 = 100.

 

controlers11

 

Right click on Loop Controller, from context menu, click on Add -> Sampler -> HTTP request.

Controlers12

Third Step: Add View Results in Table:

To view the test result in tabular format, right click on Add -> Listener -> View Result in Table

Controlers13

View Results in Table will display like given below figure,

Controlers14

Fourth Step: Run the test:

After opening View Results in Table, click on Start button on Menu bar (Ctrl+R) to run test.

 

Conclusion:

We have seen what all Logical controllers used in JMeter. The list might not seem complete to you and readers are always welcomed to suggest their views and add opinions. In next tutorial we will read about “Processors“.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>