Tuesday, 19 February 2019

How to Install JMeter Plugins Manager


Why do we need JMeter Plugins Manager

We can install all JMeter Plugins manually without JMeter Plugins Manager assistance. But maintenance of plugins becomes complicated with the time as we have to install, update, uninstall all the plugins manually. To overcome the manual efforts, JMeter Plugins Manager was introduced.

JMeter Plugins Manager comes with GUI interface through which we can Install, Update and Uninstall the required plugin easily.

JMeter Plugins Manager doesn't come with default JMeter installation. As you can see below in the screenshot there is no Plugins Manager option in Options menu. We have to install JMeter Plugins Manager manually. 


How to Install the JMeter Plugins Manager

Download the Plugins Manager JAR file and put it into JMeter's lib\ext directory.


Download JMeter Plugins Manager


We can download JMeter Plugins Manager jar from JMeter Plugins website.

Click on plugins-manager.jar link to start downloading or click here


Installing/Placing JMeter Plugins Manager Jar


  • Once the Jar File is downloaded, place the file in at lib\ext  
  • Restart JMeter

Path_to_JMeter_dir\apache-jmeter-x.x\lib\ext


Verify JMeter Plugins Manager Installation


After restarting JMeter >  Go to Options menu  > 'Plugins Manager' should be present.



JMeter Plugins Manager GUI:


JMeter Plugins Manager GUI comes with list of:

  • Installed Plugins
  • Available Plugins to install
  • Upgrades (if available any)

User can search plugin and apply changes.


Tuesday, 15 January 2019

Load Data from file in JMeter | Simulate Load with Unique Logins | Multiple User Login in JMeter

CSV Data Set Config


We cannot define a large data set in JMeter script and it is also not recommended to generate large set of random values at run-time as it is expensive in terms of CPU and memory. So we can create test data in advance and can be used as run-time parameter to create different sets of values from each run. Loading data from a file at run-time is cheaper than generating it. To Load data from a file 'CSV Data Set Config' is used in JMeter. 'CSV Data Set Config' is used to read lines from data file. Data is split according to the delimiter and assigned into variables. JMeter supports CSV files. CSV files which have a header line as the column names followed by data with new line. By using 'CSV Data Set Config' we can answer below questions.

How to load data from external data sources using JMeter
How to simulate load with concurrent unique logins using JMeter or Multiple User Login in JMeter


Multiple User Login Example: 

In this example we will load data from external data source and achieve Multiple User Login in JMeter. We will
  • Simulate a load test with 5 concurrent unique Login.
  • Username and password will be loaded from Data file.  


To do so please follow the below steps:

  • Create a test plan.
    • Test Plan contains one Thread Group. 
    • Thread Group contains: 
      •  “CSV Data Set Config” 
      •  “HTTP Request”. 
      •  “View Results Tree”


To step above Test Plan and HTTP request, please refer post: First HTTP request in JMeter | Running first JMeter Test

How to add CSV Data Set Config


  • Right-click on the Thread Group,
  • Select Add menu > Config Element > then select CSV Data Set.



CSV Data Set Config Settings:

Filename: Enter the file name only if file is present inside /bin directory else enter the complete path of file.

Variable Names(comma-delimited) : Enter the column names from the file. If headers are not present in the file then the entered variables are interpreted as the column names. JMeter supports CSV header lines: if the variable name field empty, then the first line of the file is read and interpreted as the list of column names.


Data File Configuration:

Data file contains Username and password for script as shown in figure below. Data file is stored in /bin directory and named as credentials.txt


Thread Group Configuration:

Define number of thread for test execution and duration. In this example we have set

No. of threads: 5
Ramp-up period: 1
Loop count : 1


View Results:

As you can see in figure below each thread has unique username associated with it. Total number of 5  requests are generated with different username.


Monday, 14 January 2019

First HTTP request in JMeter | Running first JMeter Test

To create a basic script in JMeter, we need to add the following components:

  • Test Plan
  • Thread Group
  • Sampler
  • Listener

Test Plan:


The Test Plan is where the overall settings for a test are specified.Option is available on Test Plan to instruct JMeter to run the Thread Group serially rather than in parallel.Static variables can be defined for values that are repeated throughout a test under User Defined Variables section.
On the launch of JMeter, Empty Test Plan is generated.


Thread Group:


The first step you have to do with JMeter Test Plan is to add a Thread Group element. The Thread Group tells JMeter the number of users you want to simulate, frequency of requests, and how many requests they should send.

How to add Thread Group:


  • Right-click on the Test Plan,
  • Click Add menu → Threads (Users) → Thread Group.



JMeter Sampler


Samplers perform the actual work of JMeter. Each sampler generates one or more sample results. The sample results have various attributes like success/failure, time etc. and can be viewed in the various listeners. We will use HTTP Sampler to generate a HTTP request.

How to add HTTP Sampler:


  • Right-click on Thread Group,
  • Click Add menu → then select Sampler → HTTP Request.


JMeter Listener


Listeners perform several roles like listening to results, view, save, and read saved test results etc. We can save results is XML and CSV format. XML is default format. We will add 'View Results in Tree' Listener.

How to add Listener:


  • Right-click on Thread Group,
  • Click Add menu → then select Listener→ View Results Tree.




Project Hierarchy

Project hierarchy will look like this:

So far we have added all the required components to the script. Lets add some data to execute our first HTTP request and First JMeter Test.

Add Users:


We will run this test with single user, single iteration. You can generate load by increasing thread group count, iteration, ramp-up  as per requirement.



Add HTTP Request

For example purpose we will use w3schools.com to craft a basic GET call and SAVE the script.

  1. Add Protocol : https
  2. Server Name : www.w3schools.com
  3. Port: 443


Run Script:

CTRL + R

Clear Data and Run Script:

CTRL + E
CTRL + R

View Results:

Results of request/response is available under View Results in Tree Listener.