JMeter Training Material
JMeter Training Material
JMeter Training Material
Introduction
Definition JMeter is an Apache Jakarta project that can be used as a load testing tool for analysing and measuring the performance of a variety of services, with a focus on web applications. Why JMeter JMeter can be used as a unit test tool for JDBC database connection, FTP,
LDAP, WebServices, JMS, HTTP and generic TCP connections. JMeter can also
be configured as a monitor, although this is typically considered an ad-hoc solution in lieu of advanced monitoring solutions.
Introduction - Features
100% pure Java Open Source Desktop application. Designed for performance/functional/load/stress testing. Extensible- write your own tests.
JMeter License
JMeter comes under Apache Software License Version 2.0 The Apache License is a free-software license authored by the Apache Software Foundation (ASF). The Apache License (versions 1.0, 1.1, and 2.0) requires preservation of the
Pre-processor elements
Post-processor elements Timers Listeners Assertions
Execution Order
Timers Preprocessors Samplers
Post-processors
Assertions Listeners
User-defined static values allow the user to define variables to be replaced with their
static value when a test tree is compiled and submitted to be run.
This replacement happens once at the beginning of the test run. Variables cannot be nested. With built-in functions users can compute new values at run-time based on previous response data.
These new values are generated fresh for every request throughout the course of the
test.
JMeter thread variables will have not been fully set up when the functions are
processed, so variable names passed as parameters will not be set up, and variable references will not work, so split() and regex() and the variable evaluation functions won't work.
The following functions should work OK on the test plan - intSum, longSum,
machineName, BeanShell, javaScript, jexl, random, time, property functions, log functions.
Functions
__functionless __counter __threadNum
__intSum
__longSum __StringFromFile __machineName __javaScript __Random __CSVRead
__property
10
Functions condt...
_P _log __logn __BeanShell __split
__Xpath
__setProperty __time __jexl __V
11
Functions condt...
__evalVar __eval __char __unescape __unescapeHtml
__escapeHtml
12
Pre-defined Variables
Most variables are set by calling functions or by test elements such as User Defined Variables. In user define variable the user has full control over the variable name
Cookiename - contains the cookie value JMeterThread.last_sample_ok - whether or not the last sample was OK true/false
START variable
13
14
15
16
17
18
19
If the request already has a value, it will be replaced. 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.
20
21
22
23
24
25
26
27
JDBC Request
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Inbuilt Add Test Inbuil Modify Test Inbuilt Delete Test Inbuilt Search Test
JMeter sends requests in the order that you add them to the tree
43
LDAP Request for Inbuilt Add test LDAP Request for Inbuilt Modify test
44
LDAP Request for Inbuilt Delete test LDAP Request for Inbuilt Search test
45
46
47
48
49
Adding a Thread bind Request Adding a search Request Adding a Compare Request Adding a Single bind/unbind Adding an Add Request Adding a Modify Request Adding a Delete Request Adding a Rename Request (moddn) Adding an unbind Request
JMeter sends requests in the order that you add them to the tree.
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Case Study
Create and run a Database test plan to test Mysql database server. OR Create and run a FTP test plan to test a FTP site.
65
Advantages
It is free Easy to install and use Compared to other load and performance testing tools, it is not only for web
66
Tips
Use timers to avoid hammering the server Limit the Number of Threads
Hardware will limit the number of threads you can effectively run. A faster machine makes JMeter work harder since it returns request quicker.
User variables
Create a text file containing the user names and passwords. Add a CSV DataSet configuration element. Name the variables USER and PASS. Use ${USER} and ${PASS} within samplers.
Use non-GUI mode. Use as few Listeners as possible. Reduce samplers by looping (by thread and by controller), and use variables (CSV Data Set) to vary the sample. Use CSV output rather than XML.
67
References
JMeter has 2 types of mailing list
http://jakarta.apache.org/site/mail2.html
68
Thank You !