Professional Documents
Culture Documents
using
Apache JMeter
Index
About - Apache Jmeter
Features
Benefits
Downloading Jmeter
JMeter Components
Preparing Test Plan
• Thread Group Control
• JDBC Connection Configuration control
• JDBC Request Control
• View Result Tree Control
Parameterization
• User Parameter Control
• CSV Data Set Config
Stored Procedure Execution
Log File
Measuring Response Time & Throughput
About Apache JMeter
Apache JMeter is open source software, a 100% pure Java
desktop application designed to load test functional behavior and
measure performance. It was originally designed for testing Web
Applications but has since expanded to other test functions.
Listeners The results of the run can be saved by these elements in the single request,
tabular forms etc by saving the results in a named file.
Timers To make the test more realistic we use Timers element to insert delays
between the requests.
Logic Logic controllers are used if you have defined the request to be executed on
some logic like if-then-else and loop structures in Java etc.
Configuration Common information about the requests is added to work with samplers
Elements using this element.
Assertions This element is used to check whether you are getting the responses within
a given amount of time containing the expected data or not.
Preparing Test Plan
Thread Group Control
Thread Group allows to run script with nth no. of users with defined
ramp-up period and also the scheduling of execution.
Right click on the Test Plan and add the Thread Group control.
Thread Properties:
Allows to set the no. of
users, ramp-up time
and iterations
JDBC Connection Configuration control
Used to configure the database i.e. Oracle, MS SQL Server etc.
Add JDBC Connection Configuration control to the Test Plan.
Important:
• Add the following Jars in JMeter Installation directory (D:\jakarta-
jmeter-2.3.1\lib)
Green: Request
passed
Red: Request failed
View Result Tree control
Request:
shows the
request
View Result Tree control
Response
data: shows the
output
Parameterization
User Parameters Control
User Parameters control allows the script to be run with multiple
values like username, password, department no. etc. We can add
variables and also provide values of the variable to multiple users.
Name: variable
name
User_1: value of
User_1
User_2: value of
User_2
Parameterization
User Parameters Control
2. Pass the variable to the query or procedure.
Syntax:
${variable_name} (e.g. ${Dept_No})
$: used to fetch the variable
value
Sample Query:
update dept set loc=‘India' where deptno=${Dept_No}
Parameterization
CSV Data Set Config Control
Allows parameterization using a file.
Add the CSV Data Set Config control to the Thread Group.
Execution of Stored Procedure
Add the JDBC Request control to the Thread Group.
• Procedure must exist in database.
Type the following command in SQL Query text box of the JDBC Request
control
Response Message:
Ok – if request passed
else error message will
be returned
Viewing SProc returning value
Choose Callable Statement from Query Type combo box.
Type the following command in SQL Query parameter of the JDBC
Request control
declare: used to
declare variable(s)
This example takes the
declare
department no as input and
deptname varchar2(20); return department name
which we store in deptname
begin variable
{call update_DEPT_PKG1.update_DEPT1(${Dept_No},?)};
end;
Callable Statement:
choose in case of PL/SQL
request
Viewing SProc returning value
ACCOUNTING:
output returned by
SProc
Log file
Create a file_name.jtl file to save log and provide the .jtl file path in
File Name text box in any of the Listener (View Results Tree).
Click on the configure button and choose the following checkbox: