Jmeter Basics

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22
At a glance
Powered by AI
JMeter is an open source load testing tool used to test performance and measure behavior under load. It is written in Java.

JMeter requires Java 1.5 or higher and has been tested on Unix, Windows, and OpenVMS operating systems.

JMeter can be used to load test servers, networks, and other resources to analyze performance under different load types.

Apache JMeter is open source software, a 100% pure Java desktop application designed to load test functional behavior

and measure performance.

Definition & Information


Apache JMeter is open source software, a 100% pure Java desktop application designed to load test functional behavior and measure performance. There are many other such tools for load testing on the market, but you will probably find that the professional ones like WinRunner are expensive to purchase. Related Information:
Developers : Apache Software Foundation Latest Version in Market: 2.4 Written in : JAVA Operating System: Cross Platform Testing Type: Load Testing License: Apache License 2.0

Basic Requirements
JMeter requires your computing environment meets some minimum requirements. Java Version o JMeter requires a fully compliant JVM 1.5 or higher. Operating Systems JMeter has been tested and works under: o Unix (Solaris, Linux, etc) o Windows (98, NT, XP, etc) o OpenVMS Alpha 7.3+

What can we do with it?


Apache JMeter may be used to test performance both on static and dynamic resources. It can be used to simulate a heavy load on a server, 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 behavior under heavy load.

JMeter features include


Features are: JMeter Can load and performance test many different server types: Web - HTTP, HTTPS SOAP Database via JDBC LDAP JMS Mail - POP3(S) and IMAP(S)
Complete portability and 100% Java purity. Full multithreading framework allows concurrent sampling by separate

thread groups.
Careful GUI design allows faster operation and more precise timings.

JMeter features continue


Caching and offline analysis/replaying of test results. Highly Extensible:
o Pluggable Samplers allow unlimited testing capabilities o Several load statistics may be choosen with pluggable timers.

o Data analysis and visualization plugins allow great extendibility


o Functions can be used to provide dynamic input to a test o Scriptable Samplers which supports BSF-compatible languages

How to use Jmeter


To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file. These files are found in the bin directory. After a short pause, the JMeter GUI should appear. [ C:\jMeter Tool\jakarta-jmeter-2.3RC3\bin > jmeter.bat ] Running Jmeter JMeter's Classpath Using a Proxy Server Non-GUI Mode (Command Line mode) Server Mode Overriding Properties Via The Command Line Logging and error messages Full list of command-line options We will continue with: Using a Proxy Server

Terms to Understand
Some Basic terms to understand
Test Plan: A test plan describes a series of steps JMeter will execute when run. A

complete test plan will consist of one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.
Thread Group: Thread group elements are the beginning points of any test plan. All

controllers and samplers must be under a thread group. The thread group element controls the number of threads JMeter will use to execute your test. The controls for a thread group allow you to set Thread properties: Set the number of threads[Users] Set the ramp-up period[in seconds] Set the number of times to execute the test [Loop Count] Each thread will execute the test plan in its entirety and completely independently of other test threads.

Terms to Understand
No. of Threads[Users]: It means to Hits from user we need for particular

time period. [Number of users to simulate]


Ramp-up Time[in seconds]: How long JMeter should take to get all the

threads started. If there are 10 threads and a ramp-up time of 100 seconds, then each thread will begin 10 [100/10] seconds after the previous thread started, for a total time of 100 seconds to get the test fully up to speed.
Time to Execute [Loop Count]:Number of times to perform the test case.

Alternatively, "forever" can be selected causing the test to run until manually stopped.

Terms to Understand
Listeners: The role of Listeners is to listen the Test Results, means

to view, save, and read saved test results. The saving and reading of test results is generic. The various listeners have a panel whereby one can specify the file to which the results will be written. o By default, the results are stored as CSV files, typically with a ".jtl" extension o To read existing results and display them, use the file panel Browse button to open the file. Samplers: 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

Terms to Understand
Workbench: The Workbench simply provides a place to temporarily store test

elements while not in use, for copy/paste purposes, or any other purpose you desire. When you save your test plan, Workbench items are not saved with it.
Logic Controllers: Logic Controllers let you customize the logic that JMeter

uses to decide when to send requests. Logic Controllers can change the order of requests coming from their child elements. They can modify the requests themselves, cause JMeter to repeat requests, etc.
Median: Midway value Throughput: Throughput measured in requests per second/minute/hour Error %: % of requests with error Average: Average time taken by the script to complete

Terms to Understand
Schedulers: When using the scheduler, JMeter runs the thread group until either the number of loops is reached or the duration/end-time is reached
o Start Time: JMeter will wait until the specified start time to begin testing. o End Time: JMeter will stop at the specified end time. o Duration(Sec): JMeter will use this to calculate the End Time.

o Startup Delay(Sec): JMeter will use this to calculate the Start Time

Standard deviation: It is a widely used measurement of variability or diversity used in statistics and probability theory. It shows how much variation or "dispersion" there is from the average (mean, or expected value). A low standard deviation indicates that the data points tend to be very close to the mean, whereas high standard deviation indicates that the data are spread out

over a large range of values.

Types of Listeners

View Results Tree: Allowing you to view the response for any sample in Tree view [Sampler Result, Request, Response Data] Summary Report:The summary report creates a table row for each differently named request in your test. This is similar to the Aggregate Report , except that it uses less memory Aggregate Report: Same as Summary Report View Results in Table: Same as View Results but uses a lot memory

How to Record the Script


Steps to record the script are:
Open Jmeter using jmeter.bat file. Set the default port 8080 for Workbench using this path
Workbench > Add > Non Test Elements > HTTP Proxy Server

Set Port : 8080 & Press Start Button


Now open the Browser the make required changes in Network Connections

using localhost proxy HTTP and Port 8080


Open the Site to record Scripts

RUN Screen
Where we can Start recording using Run Option and the shortcut is Ctrl+r

HTTP Request Screen


Information fetch on record the scripts like: Path, Method, Parameters and IP

Analyzing Test
Aggregate Report View

Analyzing Test
View Results in Tree

Analyzing Test
View Graph Results

Imp. Points to Remember

Functional Test Option should uncheck Default Port is 8080 Default Extension for Test Plan is .jmx Default Extension for Test Script is .jtl All the other web site should close All the plugins should also stop Use Browse button to save scripts from Listeners
Doesnt record https.

Advantages & Disadvantages


Advantages
Its free! Its easy to use. It has a simple and intuitive GUI. This encourages you to use

it from the start while youre developing your application Its open source. You may modify it or add new features--if you have the time and skills Disadvantages Its open source! Theres no guarantee of support or further development. However, I dont consider this a real problem with a tool like JMeter, which easily can be replaced by another tool. Getting "correct" response times from JMeter forces you to understand how to make a realistic client/server setup. Doesnt record https.

Copyright: Faisal Product Quality Engineer

22

You might also like