Table of contents
Introduction
In JMeter, correlation is very important because with the help of correlation, we can capture and store the dynamic value inside a variable and use it wherever it's required in the subsequent request.
We perform correlation because dynamic values in the script need to be correlated for performance testing.
For example, if you are testing a web application for login functionality, the server might generate a session ID after a successful login. This session ID needs to be correlated and used in the subsequent request.
Correlation can be ignored only if you are testing a static content page that doesn't contain any dynamic values.
How Correlation Works in JMeter?
Recording – Record the script using the HTTP test script recorder. This will capture all the requests and responses between the server and the browser.
Identify dynamic values – After recording, you need to find out the dynamic values in the script and correlate them. These values are typically found in the response of the server and include things like session ID.
Extracting the values – Once you identify the dynamic value, you set up the extractor (using a post-processor like Regular Expression Extractor) to capture and save this value from the response.
Using the extracted value - Finally, you use the extracted value in the subsequent request by using the variable that holds it.
Without correlation, JMeter will replay the static data in the subsequent request. This can lead to test failure or incorrect test results, especially in scenarios where dynamic data is involved.