JMETER

JMETER Introduction

JMETER Introduction

JMeter is a Java based automation framework which is used for the load test functional behaviour and measure the performance of the application. It is based on open-source technology. JMeter can be used for the performance testing of web-based applications as well as a variety of other services. It was developed by Stefano Mazzocchi. When JMeter was first developed it was used only for the testing of Web applications. However, now it is used for testing almost any kind of system and can also be used for the functional testing of applications. JMeter offers multiple parameters to mimic the actual system, configure different load and perform the performance as well as stress testing of the underlying systems and protocols.

JMeter is a Java based desktop application and as such It supports multiple platforms and can run on any kind of machine which has Java virtual machine installed, e.g., Windows, Linux, Mac. JMeter framework allows concurrent execution and hence the execution of several Threads and Threads Groups are possible by design. Being open-source technology, JMeter is extensible and also it supports a very large list of plugins available. JMeter is part of the Apache software foundation and is completely free and open source. Its UI is implemented using the Swing Java API.

Types of performance test:

• Performance tests: These tests are used to check how the system website server, database or the network behaves in terms of performance, that is, how the system responds and how is its stability for a specific workload. Performance testing checks for the responsiveness, stability, scalability, reliability, speed and resource usage of the software.

• Load testing: Load test is a type of performance testing. It is usually conducted to understand the behaviour of the system under a specific load. Load testing helps us identify the number of users which can be handled by the system.

• Stress tests: Stress test another form of performance testing and is used to determine the breakpoint or the maximum limit of the system. This is done by increasing the load till a point is reached when the system reaches its maximum threshold and then breaks.

•Spike Test -When stress test involves a sudden high ramp up in the number of users it is referred to as Spike test which is another form of performance testing.

Features of JMeter:

Listed below are the features of JMeter:

  1. JMeter is a free tool and does not involve any licence cost
  2. Supports multiple platform – It is platform-independent tool. On Linux/Unix, JMeter can be invoked by clicking on JMeter shell script. On Windows the JMeter.bat file will start JMeter.
  3. JMeter is an open-source tool.
  4. JMeter provides record and playback feature.
  5. Easily available resources 
  6. Supports an array of testing like FTP performance, database performance apart from load testing.
  7. Extensive reporting is available
  8. Non-GUI mode is available when we need to test high level load on servers to test performance.
  9. Can do performance test on multiple server type like Web - HTTP, HTTPS
    1. SOAP
    2. Database via JDBC
    3. LDAP
    4. JMS
    5. Mail - POP3(S) and IMAP(S)
  10. JMeter uses XML format to save test cases. This implies that one can generate a test plan using a text editor.

How Jmeter Works:

Jmeter mimics user actions on the application by sending requests to the server, Database or to the network. As soon as the user request is sent by Jmeter, Jmeter starts capturing the response sent. JMeter saves all the response received from the target server, analyses the response and shares the report. This report tells us about the performance behaviour of the application under test.

Limitations of JMeter

  1. Scripting in JMeter requires some level of expertise and understanding of different components of JMeter like test plan elements, regular expressions, session handling, etc.
  2. JMeter does not support network visualization feature which is provided by LoadRunner.
  3. To carry out large test with huge number of users a single normal configuration machine is insufficient. To test such cases, a very high configuration cloud machine is required or distributed testing is performed.
  4. JMeter has not support for ajax or JavaScript 
  5. It provides very limited real-time test monitoring capability as compared to other tools.

Advantage of JMeter over Load Runner

LoadRunner is another popular tool used for Performance testing and is a completion of JMeter. There are few abilities of JMeter which make it more powerful than LoadRunner.

  1. Load runner is a licenced tool and is expensive.
  2. LoadRunner provides limited capacity to generate load as opposed to JMeter which provided unlimited load generating capacity.
  3. The record and play feature of JMeter allows anyone without JMeter scripting knowledge to use the tool as well. This feature is not available in Load runner.

Installation/Environment:

JMeter is a Java based framework. JDK 1.6 or higher versions should be installed on your machine.

Windows:

  1. Install the java package suitable to your system from here.
  2. Set the JAVA_HOME environment variable to point to the base directory location, where Java is installed: JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_20 Use applicable java version
  3. Append Java compiler location to System Path. C:\\Program Files\\Java\\jdk1.7.0_25\\bin to the end of the system variable Path
  4. Check that Java is installed in your machine by going to the command line and typing java -version 
  5. Below message should be displayed:

java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

  1. Download the latest version of JMeter from here  
    • Extract it to the folder C:>JMeter for example 
    • The structure of this folder should be something like below: (wnere a.b is the version number)

 

apache-JMeter-a.b

apache-JMeter-a.b\\bin

apache-JMeter-a.b\\docs

apache-JMeter-a.b\\extras

apache-JMeter-a.b\\lib

apache-JMeter-a.b\\lib\\ext

apache-JMeter-a.b\\lib\\junit

apache-JMeter-a.b\\printable_docs

 

  1. Launch JMeter by starting the JMeter.bat programme
  2. JMeter GUI should launch as shown in figure 1 below.The GUI mode should only be used for creating the test script.CLI should be used for load testing.


Addition scripts in bin directory are as below.

 

  1. JMeter.bat -To run JMeter in GUI mode. This is default JMeter mode.
  2. JMeterw.cmd – To run JMeter without the windows shell console (in GUI mode by default)
  3. JMeter-n.cmd – Used to drop a JMX file on this to run a CLI mode test
  4. JMeter-n-r.cmd – Used to drop a JMX file on this to run a CLI mode test remotely
  5. JMeter-t.cmd – Used to drop a JMX file on this to load it in GUI mode
  6. JMeter-server.bat – Used to start JMeter in server mode
  7. mirror-server.cmd – Used to run the JMeter Mirror Server in CLI mode
  8. shutdown.cmd – Used to Run the Shutdown client to stop a CLI mode instance gracefully
  9. stoptest.cmd – Used to Run the Shutdown client to stop a CLI mode instance abruptly