DEV Community

Raghwendra Sonu
Raghwendra Sonu

Posted on

4 1

Correlation in JMeter

What is Correlation?
Correlation is Dynamic Referencing. This is the process of extracting some value from response of a step and referring it into request of other subsequent step.

Why to use Correlation?
For property transfer from one step to another. For example, after login to a website, unique session id is allocated, and this id is required in subsequent steps to interact with the server. So here Correlation will be needed.

How to implement Correlation?
using Regular Expression Extractor, in JMeter you can do correlation.

Steps for implementation.
Step 1 : Create a Test Plan with "Regular Expression Extractor" where you want to do dynamic referencing in JMeter.

Alt Text

Step 2 : Execute the test, and copy response from First Request, navigate to "https://regexr.com/" as we need to provide regular expression in the Regular Expression Extractor from where response value(s) needs to be extracted.

Alt Text

Reference Name: Any name- e.g. ReferenceValue
Regular Expression: to match in the response of first. e.g. href="(.*?)"
Template: $1$
Match No.: Your regular expression can match multiple elements, so enter match number to take one. e.g. 14
Default Value: In case no match is found,default will be used. Optional field.

Alt Text

Step 3 : Refer the extracted value (referred by Reference Name) into a subsequent step.

Alt Text

Step 4 : Run and validate the results.

Alt Text

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay