DEV Community 👩‍💻👨‍💻

Raghwendra Sonu
Raghwendra Sonu

Posted on

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 "" 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

Top comments (0)


Thank you.

Thanks for visiting DEV, we’ve worked really hard to cultivate this great community and would love to have you join us. If you’d like to create an account, you can sign up here.