Sander Stevens, TechTest, http://www.techtest.nl/
Apache JMeter is open source software, a 100% pure Java desktop application, designed to load test functional behavior and measure performance of web sites. It was originally designed for load testing web applications but has since expanded to other test functions.
Version Tested: jmeter 2.3.4 tested from October 2009 until February 2010
License & Pricing: Open Source
Support: User mailing list (firstname.lastname@example.org)
What can I do with it?
Apache JMeter may be used to test functional and performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can also use it perform a functional test on websites, databases, LDAPs, webservices etc.
The installation of JMeter (if you would call it an installation) is pretty straight forward. On the website is a link to the download area of stable versions. You also have the possibility to use nightly builds, but this is at your own risk. No guarantee that they work properly. So the advice is always to start with a stable version.
Download the latest version (zip or tgz) and unpack the archive to a local folder. Before starting JMeter it is wise to have a look at the configuration. The jmeter.properties file (located in the bin folder) contains a lot of settings. Most of those settings should be fine for the average user. The file is well documented and easy to read (and change where needed).
Also pay attention to needed additional jars. If you are going to use for example JDBC, JMS or JavaMail additional jars are not included in the JMeter installation. The user guide on the website explains how to use it and where to get it.
Starting JMeter is just a matter of double clicking jmeter.bat in the bin folder.
There is an extensive documentation on the web site. In all kinds of ways. User manual, Wikis, docs and user experiences. The user manual describes how to create specific testplans (Web, Database, JMS, Webservice, etc) including step by step instructions, examples, bitmaps and tips. Also additional information is described in the user manual like best practices, information about regular expressions and how to use the variables and predefined functions. And last but not least: the component reference describes in detail how every component can be used.
The principle of JMeter
The principle of JMeter is very simple. If you want to test e.g. a SOAP interface layer, all you basically need is the URL and SOAP request. Starting with that you can build your test plan. And this can be as fancy as you want. Using variables, counters, parameters, CSV files, loops, logs, etc. There are almost no limits in designing your test and making it as maintainable as possible.
Figure 1 - Snapshot of the JMeter interface
Letís assume you want to test a web server and fire off some http requests. Figure 1 shows a sample testplan. The testplan starts with some declarations for authorization and user defined variables. Also the JDBC connection is included. If a database is involved, you can set the database configuration and username/password. Donít forget to included the correct jars!
The HTTP request has some variables in its name. The name of the HTTP request will be displayed in the Result tree and therefore it is handy to include some kind of reference to the test you are running. In this example the testcase number, error description and error code is used to uniquely identify the request.
Figure 2 shows the detail pane of the HTTP request. You can add all the needed information like server name, portnumber, protocol (HTTPS is supported!) and parameters.
Figure 2 - Adding an HTTP request to the testplan
With regular expressions you can extract for example session ids, store them in a variable and use them in following requests.
For reporting purposes JMeter offers several possibilities. Most common is the View Results Tree. This tree will display the requests and has the ability to show the request and the response. The response can be displayed as text, XML, HTML or JSON. The component View Results Tree is mostly used for functional testing.
Figure 3 - A snapshot of the View Results Tree
Performance testing needs a more advanced kind of logging with graphs and statistical data. The component Aggregate Graph is very useful. During the performance run you can monitor all kinds of statistical data like the # samples, average, median, 90% line and min / max. All this per request and total average. The data can be written to a file (plain text, csv or xml) and after formatting can be used to create a performance report.
You also have the possibility to view a graph of the statistical data. Select you column, enter the width, height and titles and click the Display Graph button. Of course is there again the possibility to save your graph or table data to a file.
Figure 4 - Snapshot of the component Aggregate Graph
Need to test your web service, database, FTP- or web server? Both performance and functional testing? Have a look at JMeter. It is free, very intuitive and has all the possibilities you need to automate your work. Another big advantage of JMeter: open source. You can download the source and make modifications to it if you like. Also direct contact with the developers through a mailing list is very handy. Finally, if you're searching for a more robust alternative to JMeter, consider LoadView Testing, which is a fully-managed suite of tools that offers load, stress, and performance testing options.
More JMeter, Load Testing and Java Content
- JMeter-Plugins - More Obvious and Powerful Load Testing with JMeter
- Load Testing Tools
- Software Testing Magazine
- Java Tutorials and Videos
- Software Testing Tutorials and Videos