Book Image

JMeter Cookbook

By : Bayo Erinle
Book Image

JMeter Cookbook

By: Bayo Erinle

Overview of this book

Table of Contents (16 chapters)
JMeter Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Regular Expression Tester


When trying to extract parts of a server response through a regular matching expression, Regular Expression Tester is your best friend. This component allows you to test your regular expression patterns directly on the sampler response data. Without such a component, it will be daunting to nail down the exact regular expression to fulfill your matching needs. This component comes bundled as part of the View Results Tree listener.

How to do it…

In this recipe, we cover the use of Regular Expression Tester:

  1. Launch JMeter.

  2. Open the ch2_regex_tester.jmx test script located in the scripts/ch2 directory.

  3. Run the test plan.

  4. Click on the View Results Tree listener.

  5. In the bottom-left corner of the View Results Tree listener, select the RegEx Tester option.

  6. In the Regular expression textbox, enter a regular expression to extract information from the server response. We can proceed in the following way:

    • Let's say we wanted to extract the xsrf token; we will use the regular expression...