Correlation In JMeter
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.
Subscribe to my newsletter
Read articles from Gulshan Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Gulshan Kumar
Gulshan Kumar
As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman. I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.