Book Image

Master Apache JMeter - From Load Testing to DevOps

By : Antonio Gomes Rodrigues, Bruno Demion (Milamber), Philippe Mouawad
Book Image

Master Apache JMeter - From Load Testing to DevOps

By: Antonio Gomes Rodrigues, Bruno Demion (Milamber), Philippe Mouawad

Overview of this book

Load tests help identify the maximum number of requests a software system can handle. One popular open source tool for load testing is JMeter. By leveraging the features and capabilities of JMeter, you can perform extensive load testing and fix issues in your application before they become problematic. This book is written by JMeter developers and begins by discussing the whole process, including recording a script, setting it up, and launching it, enabling you to almost immediately start load testing. You'll learn the best practices that you must follow while designing test cases. You'll also explore the different protocols offered by JMeter through various real-world examples. Finally, you'll see how to integrate JMeter into the DevOps approach and create professional reports. You'll discover ways to use the eco-system of JMeter to integrate new protocols, enrich its monitoring, and leverage its power through the use of the cloud. By the end of this book, you'll know all that's needed to perform comprehensive load testing on your applications by using all the best practices and features of JMeter.
Table of Contents (14 chapters)

Setup JMeter to Record Our Browsing Session

  1. Launch JMeter:
    Figure 1.1: JMeter
    Figure 1.1: JMeter
  2. Use the Templates… feature of JMeter:
    Figure 1.2: JMeter Templates… feature
    Figure 1.2: JMeter Templates… feature
  3. Choose Recording with Think Time model and click Create:
    Figure 1.3: Recording template
    Figure 1.3: Recording template
  4. The test plan is ready:
    Figure 1.4: Result of Recording template
    Figure 1.4: Result of Recording template
  5. To save time in the future, we will select the HTTP Request Defaults element and fill in the Server Name or IP and Port Number sections:
    Figure 1.5: Result of Recording template
    Figure 1.5: Result of Recording template

    Note

    With this trick, we will share these two fields in every element HTTP Request Defaults and JMeter will not put them in each HTTP Request during recording.

    Caution

    During the load test, you should avoid having the injector (JMeter) on the same server as the application under test.

    Otherwise, the injected load will be impacted by the application's bad performance, and the application could be impacted by the injector's bad performance.

    Our tree is ready; we must now start the proxy server of JMeter.

    But before doing that, let's look at the HTTP(S) Test Script Recorder element.

  6. For the name of recorded transactions, we have two options in Recorder:

    Transaction name, which allows you to fully name them as you wish.

    Prefix, which will just prepend the prefix to the default name given by JMeter, which is usually the URL path.

    Figure 1.6: Transaction naming strategy
    Figure 1.6: Transaction naming strategy
  7. Note that with the default configuration of the template, static resources (image, CSS file, JS file…) are not recorded:
Figure 1.7: Exclude static resource capture
Figure 1.7: Exclude static resource capture

JMeter is now ready to record our navigation session.