Software Testing Class

Elements of JMeter

In previous article we have cover How to install JMeter on your machine to start running your first JMeter script. The different part or component of JMeter is called Element which co-relates with each other but designed for different-different purpose. Before start working on Jmeter, it is best to know all components or Elements of Jmeter with full detail description. From this article you will get to know the Elements of JMeter and why they are useful in JMeter.

Given below figure presents you some common elements in JMeter,

 

Test Plan

A test plan is the top level body of JMeter, explains sequence of steps execute at run time. A final test plan made up of one or more Thread Groups, Sampler, logic controllers, listeners, timers, assertions, and configuration elements. Each Sampler can be preceded by one or more Pre-processor element, followed by Post-processor element, and/or Assertion element. It saves in Java Management Extensions (JMX) format.

JMX is an open text based format, used across dissimilar systems. This format makes test plan to be open in a text editor and can use the “find and replace” function to speedily change a CMS name, web server name, or document ID that might appear hundreds of times throughout the test plan with very little determination.

 

Thread Group

Thread Group is an initial stage of test plan. The name,Thread Groups represent a group of Threads. Under this group, each thread simulates one real user requests to the server.

A control on a thread group facilitates to set the number of threads on each group. Also can control Ramp Up Time and the number of test iterations.

JMeter Thread Group

 

 

If you mention 10 numbers of threads then JMeter will generate and simulate 100 user requests to the server under test.

 

 

Controllers

There are two types of controllers: 1) Samplers 2) Logical Controllers

1)     Samplers

Samplers facilitate JMeter to deliver explicit types of requests to the server. It simulates a user’s request for a page from the target server. So that, to avail POST, GET, DELETE functions on a HTTP service, user can add HTTP Request sampler. Apart from HTTP Request sampler, there are other simpler too,

An HTTP Request Sampler looks like this figure,

 

2) Logical Controllers

Logic Controllers decide the order of processing of Samplers in a Thread. It offers a mechanism to control the flow of the thread group. Logic Controllers facilitates to customize the logic that JMeter uses to resolve when to send requests. Logic Controllers can alter the order of requests coming from their child elements.

Logic Controllers of JMeter provide,

A ForEach Controller Control Panel looks like the following figure,

 

 

Test Fragments

Test Fragments is a different type of element located at the same level as Thread Group element. It is eminent from a Thread Group in that it is not performed unless it is referenced by either a Module Controller or an Include_Controller. This element is morally for code re-use within Test Plans.

 

Listeners

Listeners facilitates viewers to view Samplers result in the form of tables, graphs, trees or simple text in some log files and also give pictorial access to the data collected by JMeter about those test cases as a Sampler component of JMeter is executed. Listeners offer a means to collect, save, and view the results of a test plan and store results in XML format, or a more efficient (but less detailed) CSV format. Their output can also be viewed directly within the JMeter console.

It basically adjusts anywhere in the test, moreover under the test plan, gather data only from elements at or below their level.

Listeners of JMeter provide these many things,

 

Timers

To perform load/stress testing on your application, you are using threads, controllers and samplers then JMeter will just blast your application with nonstop requests. This is not the real environment or characteristic of the real traffic. JMeter thread sends request without stopping between each sampler. This not exactly what you want. We can add a timer element which will permit us to define a period to wait between each request.

So, to simulate real traffic or create extreme load/stress – orderly, JMeter provides you Timer elements.

Just have a look on the types of Timers available ,

 

As an example, the Constant Timer Control Panel looks like this:

 

 

Configuration Elements

Configuration Element is a simple element where you can collects the corporate configuration values of all samplers like webserver’s hostname or database url etc.

These are some commonly used configuration elements in JMeter,

 

Pre-Processor Elements

A Pre-Procesor is an interesting thing which executes before a sampler executes. It is basically used to modify the settings of a Sample Request before it runs, or to update variables that are not extracted from response text.

These are the list made up of all the Pre-Processor Elements JMeter,

 

Post-Processor Elements

A Post Processor gets executed after finishing a sampler execution process. This element is basically useful to procedure the response data, for example, to retrieve particular value for later use.

These are the list made up of all the Post-Processor Elements JMeter,

 

Test Elements, Execution series

These are the execution order of the test plan elements,

 

Conclusion

In this article we have learn about all components or Elements of Jmeter with full detail description. In next article we will cover “Hands on with JMeter GUI”.

 

FULL LIST OF JMETER TUTORIAL SERIES

Happy Testing!!!

Exit mobile version