Book Image

Apache JMeter

By : Emily H. Halili
Book Image

Apache JMeter

By: Emily H. Halili

Overview of this book

<p>A bad response time on a website can drive away visitors and prospective customers. To measure what a website can handle, there should be a way to simulate and analyze different load scenarios&acirc;&euro;&rdquo;this is where a load-testing tool like JMeter comes in. JMeter is a powerful desktop performance tool from the Apache Jakarta project, written in Java, for load-testing web pages, web applications, and other static and dynamic resources including databases, files, Servlets, Perl scripts, Java Objects, FTP Servers, and more.<br /><br />JMeter works by acting as the "client side" of an application, and measures response time. As such, it's one half of the testing arsenal; the other half consists of a tool to watch metrics on the server side, such as thread counts, CPU loads, resource usage, and memory usage. Although it can't behave like a browser to measure rich client-side logic such as JavaScripts or Applets, JMeter certainly measures the performance of the target server from the client's point of view. JMeter is able to capture test results that help you make informed decisions and benchmark your application.<br /><br />This book introduces you to JMeter (version 2.3) and test automation, providing a step-by-step guide to testing with JMeter. You will learn how to measure the performance of a website using JMeter.<br /><br />While it discusses test automation generally, the bulk of this book gives specific, vivid, and easy-to-understand walkthroughs of JMeter's testing tools showing what they can do, and when and how to use them.</p>
Table of Contents (16 chapters)

Preface

JMeter is a powerful, easy-to-use, and FREE load-testing tool. Those are my first impressions of JMeter, a testing tool I've recently fallen in love with—not blindly. With this book, I share with you my experience with JMeter.

When I was first assigned to use JMeter to perform testing on a particular web application, I went all out looking for anything on JMeter. Despite plenty of online manuals, article and newsgroup posts, printed or e-books were nowhere to be found. So, when one of the editors of Packtpub approached me with this idea of writing a book on JMeter, I could hear myself saying: "Had there been a book on JMeter, I would have bought one at any cost. Since no one has written any, why not I write one?" After much contemplation and work, here is the result—what you are reading right now.

What The Book Is About

This book is about using basic testing tools in JMeter that support software load and regression test automation. JMeter can be used to test static and dynamic resources over a wide range of client/server software (e.g. web applications). For simplicity, this book will focus on a narrowed aspect of JMeter while demonstrating practical tests on both static and dynamic resources of a web application. As this small book is an introductory reference, it is ideally designed to pave the path for the reader to get more detailed insight on JMeter, and what more it can do beyond this reference.

What This Book Covers

Chapter 1: Automated Testing

The reader who is already automating their tests may want to skip this chapter. It takes a quick look at the need to automate testing and whether automation suits all needs of testing. It provides a quick look at and evaluation of test automation.

Chapter 2: Introduction to JMeter

This chapter is an overview of JMeter, as it takes a glance at its young history, the general look-and-feel of its GUI design, requirements, and its features.

Chapter 3: Getting Started

This chapter serves as a guide to the first-time user on installing and customizing the system environment as they run JMeter for the first time. The installation process will match the purpose of this book. Hence it will skip the more complex setup of the environment. A more complex setup guide is available from the home site of JMeter.

Chapter 4: The Test Plan

This chapter sets out to prepare the reader with the basic knowledge of tools required to successfully create and run tests. It prepares the reader for the next two chapters.

Chapter 5: Load/Performance Testing of Website

This chapter demonstrates the use of the tools in JMeter that support Load or Performance Testing. The walkthroughs are facilitated by illustrations, giving a more descriptive guide to both new and seasoned testers.

Chapter 6: Functional Testing

This chapter demonstrates the use of the tools in JMeter that support Functional or Regression Testing. Little is known of JMeter being used to support this testing approach. As in Chapter 5, the walkthroughs are facilitated by illustrations, giving a more descriptive guide to both new and seasoned testers.

Chapter 7: Advanced Features

This chapter briefly describes other resources that can be tested by using JMeter, i.e. HTTP Server, Database Server, FTP Server, using Regular Expressions, and much more. The reader may want to explore more of JMeter, once he/she has a good understanding of the basics this book covers.

Chapter 8: JMeter and Beyond

This chapter discusses briefly on what more JMeter has and can do for its users. It tells the reader where to go in order to find more information about other elements of JMeter that this book does not have.

What You Need for This Book

JMeter is a 100% pure Java desktop application. Hence, you need to first download and then install the latest production release from the Jakarta official download website: (http://jakarta.apache.org/site/downloads/index.html). Download the binary code from the JMeter package available on this site.

Who This Book Is For

The ideal readers or users of this book would be the experienced or novice testers who have been testing manually and now would like to automate their tests. Those testers who are already automating their testing using other tools or testing software may also want to use this book as they look for alternatives. This book would also be a good point for test Managers/ Leaders to start doing research on the test automation tool that may best suit their testing needs and of course, their budget. One of the many beauties of JMeter, is that one does not need to have prior programming skills to use it, making JMeter one of the most popular open-source testing tools within the testing community.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

There are three styles for code. Code words in text are shown as follows: "You may also change the default file format to save to XML, by editing the jmeter.properties file"

A code block is shown as follows. When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:

<td id="ID">${VOL_g1}</td>\s*<td id="Name">${VOL_g2}</td>\s*
<td id="Email"><a href="mailto:vol${VOL_g1}@acme-volsys.net">vol${VOL_g1}@acme-volsys.net</a></td>\s*
<td id="URL"><a href="www.acme-volsys.net/~vol${VOL_g1}">www.acme-volsys.net/~vol${VOL_g1}</a></td>\s*
<td id="Phone">9999999, ext: ${VOL_g1}</td>

Any command-line input and output is written as follows:

jmeter -H 129.198.1.1 -P 8000 -u someusername -a someuserpassword -N localhost

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "Clicking the Forever checkbox causes the test to run repeatedly until stopped manually".

Note

Important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visit http://www.packtpub.com/files/code/2950_Code.zip to directly downlad the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Questions

You can contact us at if you are having a problem with some aspect of the book, and we will do our best to address it.