Jmeter Basics

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

Transcript of Jmeter Basics

Page 1: Jmeter Basics

Apache JMeter

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

test functional behavior and measure performance.

Page 2: Jmeter Basics

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

Page 3: Jmeter Basics

Basic RequirementsJMeter 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+

Page 4: Jmeter Basics

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.

Page 5: Jmeter Basics

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.

Page 6: Jmeter Basics

JMeter features continue

Caching and offline analysis/replaying of test results. Highly Extensible:

o Pluggable Samplers allow unlimited testing capabilitieso Several load statistics may be choosen with pluggable timers.o Data analysis and visualization plugins allow great extendibilityo Functions can be used to provide dynamic input to a testo Scriptable Samplers which supports BSF-compatible languages

Page 7: Jmeter Basics

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

Page 8: Jmeter Basics

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.

Page 9: Jmeter Basics

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.

Page 10: Jmeter Basics

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

Page 11: Jmeter Basics

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

Page 12: Jmeter Basics

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 reachedo 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.

Page 13: Jmeter Basics

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

Page 14: Jmeter Basics

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

Page 15: Jmeter Basics

RUN ScreenWhere we can Start recording using Run Option and the shortcut is ‘Ctrl+r’

Page 16: Jmeter Basics

HTTP Request ScreenInformation fetch on record the scripts like: Path, Method, Parameters and IP

Page 17: Jmeter Basics

Analyzing TestAggregate Report View

Page 18: Jmeter Basics

Analyzing TestView Results in Tree

Page 19: Jmeter Basics

Analyzing TestView Graph Results

Page 20: Jmeter Basics

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 Doesn’t record https.

Page 21: Jmeter Basics

Advantages & Disadvantages

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

you to use it from the start while you’re developing your application

It’s open source. You may modify it or add new features--if you have the time and skills

Disadvantages It’s open source! There’s no guarantee of support or further

development. However, I don’t 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.

Doesn’t record https.

Page 22: Jmeter Basics

Copyright: Faisal Product Quality Engineer 22

Thank you…