Professional Documents
Culture Documents
This article will give a great understanding on Jmeter Framework needed to test
an enterprise level application to deliver it with robustness and reliability. It will
provide simple and easy steps for Jmeter installation. In this article we will also
see step by step method to test single web page in Apache JMeter.
Before digging into the JMeter, let us first understand few jargons mostly
associated with the testing of any application.
Performance Test
In software engineering, performance testing is a non-functional testing that is
performed, to determine how fast some aspect of a system performs under a
particular workload. It can also serve to validate and verify other quality
attributes of the system, such as scalability, reliability and resource usage. It can
compare two systems to find which performs better. Or it can measure what part
of the system or workload causes the system to perform badly. It also highlights
early in the testing process if changes need to be made before application goes
into production.
Load Test
This test is basically used for exercising\discovering the system under the top
load it was designed to operate under.
Stress Test
This test is an attempt to break the system by overwhelming its resources.
INTRODUCTION
Jmeter
JMeter is an application that allows to load test or performance oriented business
(functional) test on different protocols or technologies. Stefano Mazzocchi of
the Apache Software Foundation was the original developer of JMeter. He wrote it
primarily to test the performance of Apache JServ (Now called as Apache Tomcat
project). Apache later redesigned JMeter to enhance the GUI and to add
functional-testing capabilities.
Jmeter is a Java desktop application with a graphical interface using the Swing
graphical API, can therefore run on any environment / workstation accepting a
Java virtual machine, for example: Windows, Linux, Mac, etc.
Step 2: Installation
Unzip the zip/tar file into the directory where you want JMeter to be
installed.
GUI Mode
Server Mode
5. Timers
By default, a JMeter thread sends requests without pausing between each
sampler. This may not be what you want. You can add a timer element
which allows you to define a period to wait between each request.
6. Assertions
Assertions allow you to include some validation test on the response of
your request made using a Sampler. Using assertions you can prove that
your application is returning the correct data. JMeter highlights when an
assertion fails.
7. Configuration Elements
Configuration Elements allow you to create defaults and variables to be
used by Samplers. They are used to add or modify requests made by
Samplers.
They are executed at the start of the scope of which they are part, before
any Samplers that are located in the same scope. Therefore, a
Configuration Element is accessed only from inside the branch where it is
placed.
8. Pre-Processor Elements
A pre-processor element is something that runs just before a
sampler executes. They are often used to modify the settings of a
Sample Request just before it runs, or to update variables that are
not extracted from response text.
9. Post-Processor Elements
A post-processor executes after a sampler finishes its execution. This
element is most often used to process the response data, for example, to
retrieve a particular value for later use.
Change the name of test plan node to Sample Test in the Name text box.
You have to change focus to workbench node and back to Test Plan node
to see the name getting reflected.
Save the test plan.
Right click on Sample Test (our Test Plan)> Add> Threads (Users)> Thread
Group. Thread Group will get added under the Test Plan (Sample Test)
node.
Number of threads indicates the number of users to be simulated.
Ramp up period is the time over which all the sessions will start uniformly
one by one.
Right click on workbench and add the Http proxy Server: Add -> Non- Test
Elements -> Http Proxy Server. Port field - Enter "8080" (Any other value
would do).
Go to Target Controller click on the drop down and Sample Test (our test
plan) < Thread Group.
Gaussian random timer should be used if you want JMeter to record the time
taken by the human user between clicking different links across the GUI. While
executing the test case, the HTTP requests would be sent one after another
maintaining the same time gap (as taken by the user). If Gaussian random timer
is not used, all the requests would be pumped to the server at once. I am sure
that nobody wants to test such an unrealistic scenario.
8. Add Listeners
Right-click on Thread Group -> Add -> Listener -> View Results in Table &
View Results Tree & Aggregate Report & Summary Report.
Listeners let you view the results of Samplers in the form of tables, graphs,
trees or simple text in some log files.
Open the browser and configure proxy settings to point to JMeter's proxy
server.
For Mozilla browser, click on Firefox tab seen in top left of the menu bar.
Click Options tab.
Select advanced options ->Network->Settings-> Check Manual proxy
configuration -> Input "localhost" in Http Proxy and "8080" in Port.
Check Use this proxy server for all protocols
In the address bar type the URL of the application you want to test.
Browse the application.
Click on the Stop button from the Proxy Server once the recording is
finished.