Skip to main content

JMeter-Performance-test tool

JMeter-Performance test tool

 

The Apache JMeter application is open source tool designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Apache JMeter may be used to test performance both on static and dynamic resources (Webservices (SOAP/REST), Web dynamic languages – PHP, Java, ASP.NET, Files, etc. -, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

Apache JMeter features:

  • Ability to load and performance test many different server/protocol types:
    • Web – HTTP, HTTPS
    • SOAP / REST
    • FTP
    • Database via JDBC
    • LDAP
    • Message-oriented middleware (MOM) via JMS
    • Mail – SMTP(S), POP3(S) and IMAP(S)
    • MongoDB (NoSQL)
    • Native commands or shell scripts
    • TCP
  • Complete portability and 100% Java purity.
  • Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
  • Careful GUI design allows faster Test Plan building and debugging.
  • Caching and offline analysis/replaying of test results.
  • Highly Extensible core:
    • Pluggable Samplers allow unlimited testing capabilities.
    • Several load statistics may be chosen with pluggable timers.
    • Data analysis and visualization plugins allow great extensibility as well as personalization.
    • Functions can be used to provide dynamic input to a test or provide data manipulation.
    • Scriptable Samplers (BeanShell, BSF-compatible languages and JSR223-compatible languages)

Download and Install JMeter

How-to-Install-Jmeter

Prerequisites to download and Install JMeter

Operating System

JMeter is a pure Java application and should run correctly on any operating system like Linux 2.4 and up, Mac OS 10.6.8, Windows XP, Windows 7, etc..that has compatible Java implementation.

 Install Java

Check the Java installed or not in your system in windows using the below command from command prompt.

To open command prompt press (Window + R) then write cmd and enter

Now write command- >Java – version  (see below snap, Java is already installed)

Java_Version

If Java is not installed, You can download and install the latest version of Java SE Development Kit from here( click here)

Download JMeter

Download the latest version of Apache JMeter 2.13 click here Choose the Binaries file (either zip or tgz) to download.

JmeterDownload

Install JMeter

Unzip the zip/tar file into the directory where you want JMeter to be installed.

Once the unzipping is complete, the installation directory structure should look like as figure below

JMeterInstalledFolder

Launch JMeter

Launch Jmeter from bin folder that is apache-jmeter-2.13\bin\JMeter .Double click jmeter batch file or run from command prompt.

JMeter

Test Plan node − is where the real test plan is kept.
Workbench node − It simply provides a place to temporarily store test elements while not in use, for copy/paste purposes. When you save your test plan, Workbench items are not saved with it.

JMeter Test Plan

Step1:  Open the JMeter window by clicking on C:\Users\SRinivas\Downloads\apache-jmeter-2.13\apache-jmeter-2.13\bin\jmeter.bat (jmeter.bat on windows and jmeter.sh on unix )

JMeter

Step2: Rename the TestPlan to  ‘FirstTest’

Rename_TestPlan

Step3: Add Thread Group

Right-click on the FirstTest (our Test Plan) > Add > Threads (Users) > Thread Group. Thus, the Thread Group gets added under the Test Plan (FirstTest) node.
Add_ThreadGroup

  • Set the number of threads
  • Set the ramp-up period
  • Set the number of times to execute the test

The Thread Group Control Panel looks like this −

Add_ThreadGroup2

The Thread Group Control Panel holds the following components −

Action to be taken after a Sampler error − In case any error occurs during test execution, you may let the test either −

  • Continue to the next element in the test
  • Stop Thread to stop the current Thread.
  • Stop Test completely, in case you want to inspect the error before it continues running.

Number of Threads : Simulates the number of users or connections to your server application.
Ramp-Up Period: Defines how long it will take JMeter to get all threads running.
Loop Count:  Defines the number of times to execute the test.
Scheduler checkbox:− Once selected, the Scheduler Configuration section appears at the bottom of the control panel.
Scheduler Configuration:  You can configure the start and end time of running the test.

Step4: Add Sampler

Select “thread group” >Right click “add>Sampler>HTTP Request

Samplers tell JMeter to send requests to a server and wait for a response. They are processed in the order they appear in the tree. Controllers can be used to modify the number of repetitions of a sampler.

Each sampler has several properties you can set. You can further customize a sampler by adding one or more Configuration Elements to the Test Plan.

 

AddHTTPSampler

It will add one empty HTTP Request Sampler under the Thread Group node.

Name − Name would be anything, We will change the name to reflect the action what we want to achieve. We will name it as ‘onlinetraining.etestinghub.com’

Server Name or IP − Here, we have to type the web server name. for example www.onlinetraining.etestinghub.com/

Protocol − We will keep this blank, which means we want HTTP as the protocol.

Path − We will type path as / (slash). It means we want the root page of the server.

Step5: Add Listner

Here we are going to view the load test results, to do this-

Select “thread group” >Right click “add -> listener -> aggregate report” to add an aggregate listener. The aggregate listener will show some basic statistics

Add_Listener

Step6: Run Test 

Select Run from the menu and select Start option or click Ctrl+R. Apache JMeter asks us to save the test plan in a disk file before actually starting the test. This is important if you want to run the test plan multiple times. You can opt for running it without saving too.

Step7: View the Results

At the end of the test, the aggregate report should look like this

In my TestPlan, Number of threads –  “5”

Ramp up Period – 1

Loop count – 100

5*100=500 samples can be seen below!

ETH_AggregateReport