Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JMeter Cookbook

You're reading from   JMeter Cookbook 70 insightful and practical recipes to help you successfully use Apache JMeter

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher
ISBN-13 9781783988280
Length 228 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Bayo Erinle Bayo Erinle
Author Profile Icon Bayo Erinle
Bayo Erinle
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. JMeter Fundamentals FREE CHAPTER 2. Handling Responses 3. Building Robust Test Plans with Controllers 4. Testing Services 5. Diving into Distributed Testing 6. Extending JMeter 7. Building, Debugging, and Analyzing the Results of Test Plans 8. Beyond the Basics A. Installing the Supporting Software Needed for this Book Index

Recording scripts via the Chrome browser extension

Recording test scripts is one you will be doing quite often. There are many alternatives to how we can record test scripts in JMeter.

How to do it…

In this recipe, we show you how to record test scripts with just a browser add-on installed on the Google Chrome browser. Perform the following steps:

  1. Install the Google Chrome browser if it's not already installed on your machine.
  2. Open the Chrome Web Store.
  3. Search for blazemeter on the web store.
  4. Install the BlazeMeter browser extension by clicking on the Free button.

    Note

    Once installed, a new BlazeMeter icon will be placed in the top-right corner of your browser toolbar.

  5. Click on the newly added BlazeMeter extension button in the top-right corner of your browser toolbar.
  6. Press the Record button.
  7. Point your browser to a website of your choice.
  8. Navigate through the website as you will normally do as a user.
  9. After the previous step, stop the recording and click on the export to jmx button (.jmx). This will download a copy of your script to your local machine.
  10. Open the exported test script in JMeter.
  11. Add View Results in Tree Listener to the test plan (Test plan | Add | Listener | View Results in Tree Listener).
  12. Run the exported test script with JMeter.
  13. View the results.

    Tip

    Exporting your recorded test plan requires a free account with BlazeMeter for you to be logged in.

    How to do it…

    Installing the BlazeMeter Chrome extension

The BlazeMeter Chrome extension should look similar to what is shown in the preceding screenshot. Using this extension, additional properties can be configured in the Advance section of the extension. The following is a screenshot of the extension:

How to do it…

Using the BlazeMeter Chrome extension

How it works…

The browser extension captures the user interaction with the website in the JSON format as long as the recorder is on.

When the recording is stopped, no further user actions are captured. After the export button has been clicked on the JSON format is then converted to the XML format, which JMeter understands and can work with. The downloaded recorded script can then be edited and run within JMeter like any other script.

There's more…

The extension allows you to selectively capture requests by providing you with the ability to pause recording in between the user interactions. It also allows you to filter out unwanted traffic you might not be interested in capturing in your test scripts through the include filter pattern text area.

Furthermore, the Advance menu option allows you to gain more control over which requests are captured in your script, allowing you to capture only the top-level requests (default), disable browser cache (default), disable recording cookies (default), and edit the setting before proceeding to run.

Finally, as BlazeMeter (one of the many providers offering distributed testing in the Cloud) provides this extension, it offers additional features including the following:

  • Allows you to run your scripts directly in the Cloud (see Chapter 5, Diving into Distributed Testing)
  • Allows you to simulate thousands of users with ease (see Chapter 5, Diving into Distributed Testing)
You have been reading a chapter from
JMeter Cookbook
Published in: Oct 2014
Publisher:
ISBN-13: 9781783988280
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime