Load Testing with Apache JMeter 101
Author: Antonio Navas
Date: June 25th 2011
JMeter from the Apache Jakarta project is a popular open source tool used for load testing client/server applications.
- Zero cost – simply download the software from here: http://jakarta.apache.org/jmeter/index.html
- Easy to learn and excellent documentation.
- JMeter can load test a variety of project types including like HTTP, FTP, SOAP, Databases, LDAP, JMS, etc.
- Supports large-scale testing from multiple machines with many threads providing concurrency and the ability to use different timers that will allow the simulation of various types of loads.
- API and plug-ins available allowing customization.
- Built-in functions that can be used to provide dynamic input to tests.
For this demo, we’ll be using version 2.4 r961953.
On the website is a link to the download area of stable versions. Download the latest version (zip or tgz) and unpack the archive to a local folder. We’ll refer to this directory as [JMeter-Root].
In order to run JMeter, we need to run one of the following:
- [JMeter-Root]/bin/jmeter.bat (in Windows).
- [JMeter-Root]/bin/jmeter (in Unix).
After the main screen loads (see picture below), you’ll notice two elements in the left pane, Test Plan and Workbench. The Test Plan contains the running test. The Workbench contains any test or portion of a test that you are working on.
Before we are able to create and run a test, we need to understand what application we want to test.
The Application Under Test (AUT): For this demo, I will be testing an application with the following elements in the buy-flow:
- Landing Page: Initial page in which customers will enter an address, a phone number or both and submit a service request.
- Processing Page: In this page customers would be asked – if needed – to confirm address; to provide apartment information – if it was not entered in Landing Page and if the system finds it is needed – or to answer a quick survey while their request for services is processed in the back end.
- Services Page: In this page customers can see services available for the address provided, review services details, price, promotions, compare services, etc.
- Place Order Page: Once one or multiple services are added to the shopping cart, customers will be taken to this page where they will be asked to enter payment information, his/her credit will be verified, select installation dates, see taxes, deposits or any other charges due with the order.
- Order Confirmation Page: Once the order is processed, customer is taken to this page. Offer details, order confirmation number and order summary information will be shown here.
The Test Case should include the following scenarios:
- Launch Landing Page and capture the Session Id from the response received.
- From this point on, requests will need to include the session Id captured here.
- Re-Launch Landing Page and pass back to the system the Dynamic Session Id captured above.
- Submit request for services (including address, apartment, city, state, zip code, etc.) – address provided will be verified as a valid US address.
- Submit request for services – available services collected from a catalog database or thru calls to one or multiple third party service providers.
- Launch Show Services Page – show services returned from call above.
- Show Services Details – display service price, description, promotion(s) and other information.
- Add Service(s) to Shopping Cart.
- Show Services Details in Shopping Cart – display service price, description, promotion(s) and other information.
- Navigate to Place Order Page.
- Show Services Details in Place Order Page – display service price, description, promotion(s) and other information.
- Validate Order Information – verify customer credit using SSN or Driver License information; display additional services, deposits or extra fees, installation dates, etc.
- Submit Order – Customer completes and submit the order.
- Order Confirmation Page – Order confirmation number, order summary and service details are displayed.
- Show Services Details in Order Confirmation Page – display service price, description, promotion(s) and other information.
This was the basics of understanding a test case in JMeter, be sure to read part 2 of “Load Testing with Apache JMeter” to learn how to build JMeter scripts.