Professional Documents
Culture Documents
A Basic Walkthrough
How To Install
Install Java
Download Jmeter
Directory Structure
Test Elements
Thread Group
Controllers
Samplers
Timers
Assertions
Configuration Elements
Pre-Processor Elements
Post-Processor Elements
Configuration elements
Pre-Processors
Timers
Sampler
Test Plan
Bluiding A Test Paln in Jmeter
Test Plan
Thread Group
Introduction
Thread group elements are the beginning points of any test plan.
All controllers and samplers must be under a thread group.
Other elements, e.g. Listeners, may be placed directly under the test
plan.
Thread group element controls the number of threads JMeter will
use to execute your test.
controls for a thread group allow you to set:
number of threads
ramp-up period
number of times to execute the test.
Ramp Up Periode
Each thread will execute the test plan in its entirety and completely
independently of other test threads.
Ramp Up Periode : If 10 threads are used, and the ramp-up period
is 100 seconds, then JMeter will take 100 seconds to get all 10
threads up and running. Each thread will start 10 (100/10) seconds
after the previous thread was begun.
Loop Count Defines the number of times to execute the test.
Configuration Element
Configuration elements can be used to set up defaults and
variables for later use by samplers these elements are
processed at the start of the scope in which they are found,
i.e. before any samplers in the same scope.
List
The cookie manager stores and sends cookies just like a web browser.
If you have an HTTP Request and the response contains a cookie, the
Cookie Manager automatically stores that cookie and will use it for all future
requests to that particular web site.
This element lets you set default values that your HTTP Request controllers use. For example, if
you are creating a Test Plan with 25 HTTP Request controllers and all of the requests are being
sent to the same server, you could add a single HTTP Request Defaults element with the "Server
Name or IP" field filled in. Then, when you add the 25 HTTP Request controllers, leave the
"Server Name or IP" field empty. The controllers will inherit this field value from the HTTP Request
Defaults element.
The Header Manager lets you add or override HTTP request header
We record Header manager along with each HTTP request
Random Variable
Counter
JMeter
Preprocessors
What is it
Add a Preprocessor
Send to server
Correlation
Its a procedure to fetch a dynamic value from earlier responses and using
that value in subsequent steps
Parameterization
Using Parameterization we can execute one test plan for more than one user at the
same time. This is a method of generalizing an action for many users.
Suppose, we have to do load test of a search engine, for that we record the search
scenario. Now to do effective load test, we can't just playback the script for say 100
users. We should simulate 100 users that search for 100 different things. Here we
need parameterization, wherein we can have a CSV file that contains 100 different
items. Now instead of the static search item that we had recorded in our script we can
include the search items from the CSV file dynamically.
We will use 'CSV Data Set Config'. to achieve this in JMeter
Synchronization
Coordinating two or more activities, devices, or processes in time.
We need Synchronization to avoid the condition like deadlock.
We can achieve synchronization by using 'Interthread commincation Preprocessor'
and 'Synchroization Timer'
List
BeanShell
BSF
HTML Link Parser
HTTP URL Rewriting Modifier
Regex user Parameter
User parameter
JDBC
Interthread Communication .
JSR233
Raw Data Source
Beanshell
We wrire arbitary code which execute before sample request we can use it
for parameterization
BSF
Test Plan
Step 4: Create a CSV file for the fields like User ID , Password ,
e-Mail , Name. Add a CSV Data Config[Config element] to use
the values in Jmeter from the CSV file .
Step 5: Add the SignUp.aspx[Method : GET] Under the Thread Group . So that HTML
Link Parser can fetch the value from the HTTP response .
Step 6: Add the Signup.aspx[Method : POST] as the next HTTP request in the same
Thread Group.
Step 9: Now its time to use the value we parsed using the HTML Link Parser .
Just put [.*] excluding the braces as the Value to the Dropdown field name in the
SignUp.aspx[Method : POST] Panel.
Step 10 : Add a Listener [Preferably View Result in Tree ]. Then Execute/Run the Test
plan .
Consider a simple example: let's say you wanted JMeter to "spider" through website
under test, parse link(check all links on the page) and return the HTML. You would
add some action such as "HTML link parser" to your controller before creating an
HTTP request.
If "Cache Session Id?" is checked, then the last found session id will
be saved, and will be used if the previous HTTP sample does not
contain a session id.
Example
There is a sample
request contains
parameters in url,
what url rewiting do
extract parameter
form url and process
the request as using
session argument
name
In View Result Tree listener, go to the response data from where we need to fetch quantity
information. Lets assume the quantity information in response data is <input type=text
name=quantity value=2>. We would be fetching value 2 from this response using regular
expression.
Add Regular Expression Extractor post-processor under this request. We need to now write a
regular expression to fetch quantity value. It can be written as <input type=text name=quantity
value=(.+?)>.
Supply the above expression in Regular Expression field of Regular Expression Extractor postprocessor. Provide other details as well. Template as $1$, Match No. as 1, Default Value as Not
Found, Reference Name as Quantity. Refer this link to know more about all these fields in
Regular Expression Extractor.
Thats it. You can now pass quantity information in subsequent requests using Reference Name
Eg. ${Quantity}.
If you are facing any issue while fetching value, try debugging your regular expression
User Parameter
Allows the user to specify values for User Variables specific to individual threads.
allows you to specify a series of values for any User Variable
Data driven testing with Jmeter user parameters
Based on your requirements, you can select either CSV config element or User
Parameter pre-processor element for data driven testing. If you have large number of
variables to be parameterized, CSV config is the best option.
Example
Interthread Communication
fifoGet differs from fifoPop, it does not wait for data, just returns empty string if
no data present in queue. Also it does not remove values from the queue.
fifoSize returns the number of items in the queue.
Timers
By default, JMeter sends the request without pausing between each request. In that
case, JMeter could overwhelm your test server by making too many requests in a
short amount of times This may not be what you want. We can add a timer element
which will allow us to define a period to wait between each request.
Timers allow JMeter to delay between each request which a thread makes. Timer can solve
the server overload problem.Also, in real life visitors do not arrive at a website all at the
same time, but at different time intervals. So Timer will help mimic the real time behavior.
We use Timers to implement the THINK TIME
List
Constant Timer
Synchronizing Timer
JSR223 Time
BeanShell Time
BSF Time
Constant Timer
This timer allows us to keep total throughput constant.Although the Timer is called the Constant
Throughput timer, the throughput value does not need to be constant. This value can be changed
during a test.
Synchronizing Timer
BSF Timers
Bean Scripting Framework is a set of Java
classes that is provides scripting
language support within Java applications,
and access to Java objects and methods
from scripting languages)
Logic Controllers
List
Simple
Loop
Once Only
Interleave
Random
Random Order
Throughput
Runtime
If
While
Switch
ForEach
Module
Include
Transaction
Recording
Simple controller
Loop Controller
The Once Only Controller will make its child samplers run only once
per thread i.e. only in the first loop.
Interleave Controller
Interleave Controller will make one of
samplers contained in it run in each loop
of the thread and but the samplers in each
loop will be in sequential order.
Random Controller
Random Controller makes all the user requests
run in random order in each loop period.
Throughput Controller
Runtime Controller
Runtime Controller's function is same as
its name. You can set time in Runtime
Controller to stop jmeter requests
execution after defined time
If Controller
The If Controller allows the user to control
whether the test elements below it (its children)
are run or not
While Controller
The While Controller runs its children until
the condition is false
Switch Controller
Under Swicth controller you will execute
only specified sample
ForEach Controller
Module Controller
JMeter Module
Controller allows
switching between
pieces of the test plan
The goal of Module
Controller is to add
modularity to JMeter.
Include Controller
The include controller is designed to use
an external jmx file
It is created to utilize an external test plan.
This controller permits you to utilize
multiple test plans in JMeter.
Transaction Controller
Recording Controller
The Recording Controller is a place holder
indicating where the proxy server should record
samples to
Liteners
List
Agreegate Graph
Agreegate Report
Assersion Results
Beanshell
BSF
Comparision Assersion Visulizer.
Backend
Generate Summary Results
Graph Results
Active Threads Overtime
Autostop
Bytes Throughput Overtime
Composite Graph
Transaction Throughput vs Threads
Transaction/ Sec
Mailer Visulizer
Monitor Results
Summary Report
View Result in Table
Throuthput
Latency
Response Time
Elapsed time
Connect Time
Median
90% Line (90th Percentile)
Standard Deviation
Resource Utilization
Hits
Users
Errors
Bandwidth
Metric Definations
Metric Definations
Resource Utilization - Resource usage (processor, memory, network I/O, disk I/O)
on the server.
Connect Time. JMeter measures the time it took to establish the connection,
including SSL handshake. Note that connect time is not automatically subtracted from
latency.
Median is a number which divides the samples into two equal halves. Half of the
samples are smaller than the median, and half are larger. [Some samples may equal
the median.] This is a standard statistical measure. same as the 50th Percentile
90% Line (90th Percentile) is the value below which 90% of the samples fall. The
remaining samples too at least as long as the value. This is a standard statistical
measure.
Error %.
Throughput.
Min,Max & Average response.
Average Bandwidth.
Median
Standerd Deviation.
Response Time
Others
Assersion Results.
Shows the faliure of any request along with it's label.
Autostop.
AutoStop used when you want to stop test on some runtime criteria.
average response time
average latency
error rate.
Graph Liteners
Agreegate Graph
Display average response time vs thread
Graph Results
Shows average response time alogwith median throughput and deviation.
Composite Graph
Shows several different graphs composed to one
Graph Generator
Monitoring Liteners
DBMon Samples Collector
JMXMon samples Collector
PerfMon Mertic Collector
Scripting Liteners
Beanshell
BSF
JSR223 Listener