Correlation is the process of extracting dynamic values from server responses and using them in subsequent requests.
It helps in parameterizing dynamic data such as Session IDs, Tokens, Timestamps, Order IDs, ViewState, etc., to simulate real user behavior.
1
Identify
Identify the dynamic value in the server response.
2
Create Rule
Create a correlation rule using appropriate method (Reg Exp / HTML / JSON / XPath / etc.).
3
Extract & Save
Extract the value and save it to a parameter.
4
Use Parameter
Use the saved parameter in subsequent requests where required.
5
Validate
Run the script and validate that the value is captured and used successfully.
Choose Tool
LoadRunner (VuGen) – Correlation Guide
LoadRunner Overview
LoadRunner uses C-based functions like web_reg_save_param to capture dynamic data. The correlation function must be placed before the request that generates the dynamic value.
Correlation Types
LoadRunner supports both Auto Correlation (Design Studio) and Manual Correlation. Manual correlation is highly recommended for stability.
Manual Correlation Process
Manually we have to handle the dynamic values. Whatever the steps performed by autocorrelation will be performed manually.
Step 1: How to identify the dynamic values in a script?
Sol: Record the same business scenario twice with 2 sets of data & compare both of them using "beyond-compare" or "www.text-compare.com" or Tools "Windiff" (default). Which values reported differently those values will be considered as dynamic values.
Note: Which values are not enter through keyboard & which values are chosen from the application, those values will be considered as dynamic values.
Step 2: How to identify the left text & right text for a dynamic value?
Sol:web_reg_save_param("parameter_name", "lb=", "rb=", LAST);
1. Copy the dynamic value.
2. Go to generation log identify first occurrence of the dynamic value.
3. Copy the left text & right text of the dynamic value.
Step 3: Where to write the function?
Sol1: Execute the script in full mode (F4 → LOG → Extended Log → Enable All Options). Identify the dynamic value based on the left boundary or right boundary in Replay log. Double click on the same line which will assist you to where to write the function or for which request the dynamic value was generated.
Sol2: (Not recommendable for web tours) once you identified the dynamic value in generation log place the cursor on the same line and search for "web_" or "ENDED" then copy the request and search for the same in script. On top of the same request u can place the function.
Note: Generation log contains response and request which never change.
Step 4: Substitution
Sol: You can substitute the parameter name where ever the dynamic value is present in script using control+H.
Correlation Function with all Arguments
1. ORD:
ORD stands for "Occurrence". By default ORD=1. Ord=10 stands for 10th occurrence. Ord=ALL stands for captures all values based on LB & RB. Whenever you written ORD=ALL your parameter become an Array. It holds all the values with the name of parameter-1, parameter-2 & parameter-N. Note:Variable_count let we know the length of an Array.
2. Save Length:
Allow you to capture specific no. of characters from dynamic value based on LB and RB.
Ex: savelen=3
By default savelen="-1".
3. Save offset:
It will specify the no. of characters it supposed to skip from the dynamic value.
By default saveoffset="0".
EX: saveoffset=3 (It skips 3 char)
4. Not found:
By default notfound="error". If the either LB or RB is not present in the response script will through the error like "No match found for the requested parameter". notfound="warning": If you would like to continue the script execution, even LB or RB is not available in the response you have to use warning.
5. Search:
It is an optimization technique. Which will instruct the user to search for LB & RB in a specific location. By default search=ALL.
Ex: Search=headers - it will search for LB n RB in only on header.
Ex: Search=body - it will search for LB n RB in only on body.
6. RelframeID:
This is also optimization technique. Specifying to capture the dynamic value from a specific frame.
Ex: RelframeID=1.2.1
LoadRunner provides built-in parameter types to store dynamic values. Choose the right parameter type based on the use case.
Select the text and create rule (Reg Exp / HTML Tag / XPath / etc.).
4. Save Parameter
Choose parameter type (LB / WB / RB / ORD / DSE) and save.
5. Validate
Run the script and verify the value is captured and used correctly.
LoadRunner – Correlation Methods
Method
Description
When to Use
Example
Regular Expression
Extracts text using a regular expression pattern.
When value is in fixed or semi-structured text.
sessionId is (\w+)
HTML Tag
Extracts value from HTML tag attribute or inner text.
When value is in HTML response.
<input name="token" value="(.*?)" />
XPath
Extracts value using XPath query.
When value is in XML/HTML with complex structure.
//orderId/text()
JSON Extractor
Extracts value from JSON response.
When response is in JSON format.
$.data.token
Sub-String
Extracts value between start and end boundaries.
When pattern is not suitable for Reg Exp.
Start: uid= End: &
JavaScript
Uses JavaScript to extract complex or dynamic values.
When built-in methods are not sufficient.
return "TOKEN_" + args[0].match(/(\w+)/)[0];
Apache JMeter – Correlation Guide
JMeter Overview
JMeter uses Post-Processors (like Regular Expression Extractor, JSON Extractor, and XPath Extractor) to extract values and save them into Variables. Post-Processors execute after the Sampler they are attached to.
JMeter provides multiple post-processors to extract dynamic values. Choose the right extractor based on the response format.
JMeter – Extractors
Extractor
Description
When to Use
Variable Access
Regular Expression
Extracts via Regex pattern.
Most common, unstructured text.
${varName}
JSON Extractor
Extracts via JSONPath.
When response is JSON.
${varName}
XPath Extractor
Extracts via XPath queries.
When response is XML.
${varName}
CSS Selector Extractor
Extracts via CSS queries.
When response is HTML.
${varName}
Boundary Extractor
Extracts between boundaries.
Faster than Regex, fixed bounds.
${varName}
Manual Correlation Process in JMeter
Handling dynamic values manually in JMeter using Post-Processors.
Step 1: Identify the dynamic values
Sol: Record the scenario twice or use the View Results Tree listener to compare responses. Look for values like session IDs, tokens, or any random string that changes between iterations.
Step 2: Determine Extractor & Boundaries
Sol: Identify the format of the response (HTML, JSON, XML).
- Use JSON Extractor for JSON responses (e.g., $.token).
- Use Regular Expression Extractor for unstructured text (e.g., name="token" value="(.*?)").
- Use Boundary Extractor if you know the exact left and right boundaries.
Step 3: Where to add the Extractor?
Sol: Find the HTTP Request Sampler that generates the dynamic value in its response. Right-click that sampler → Add → Post Processors → [Select Extractor].
Configure the extractor with a Variable Name (e.g., p_sessionId) and the extraction rule.
Step 4: Substitution
Sol: Search for the hardcoded dynamic value in subsequent HTTP requests and replace it with the JMeter variable syntax: ${p_sessionId}.
JMeter – Correlation Examples
Scenario
Extractor
Example (Response Snippet)
Rule / Expression
Used In Request
Session ID
JSON Extractor
{"sessionId": "ABC123XYZ789"}
JSONPath: $.sessionId
/profile?sessionId=${p_sessionId}
Token
Regular Expression
<input name="token" value="TOKEN_123" />
Regex: value="(.*?)"
/api?token=${p_authToken}
Order ID
Boundary Extractor
Your Order ID is ORD123.
LB: Your Order ID is RB: .
/details?id=${p_orderId}
NeoLoad – Correlation Guide
NeoLoad Overview
NeoLoad provides an advanced Variable Extractor with a visual interface for boundaries, RegExp, JSONPath, and XPath extraction directly within the request configuration. It provides automatic correlation during the design phase.
NeoLoad supports automatic correlation frameworks and manual variable extraction.
NeoLoad – Extractors
Extractor
Description
When to Use
Variable Access
Variable Extractor
Visual extraction (LB/RB or Regex).
Most common, unstructured text.
${varName}
JSONPath
Extracts via JSONPath.
When response is JSON.
${varName}
XPath
Extracts via XPath queries.
When response is XML.
${varName}
Manual Correlation Process in NeoLoad
Extracting dynamic values manually using NeoLoad's advanced Variable Extractor.
Step 1: Identify the dynamic values
Sol: Use the "Check User Path" feature or compare recorded vs. played back responses in the logical actions tree. Identify values that are flagged or cause the script to fail.
Step 2: Define the Extractor
Sol: Open the request that generates the dynamic response. Go to the "Advanced" → "Variable Extractors" tab.
Click the magic wand icon to easily select the left and right boundaries visually from the response content.
Step 3: Variable Configuration
Sol: Name the variable (e.g., p_orderId). Choose if you want to extract by boundaries, Regular Expression, JSONPath, or XPath. You can test the extraction immediately in the UI to ensure it captures correctly.
Step 4: Substitution
Sol: Search for the dynamic value in subsequent requests and use the "Search and Replace" feature to substitute the hardcoded value with the variable syntax: ${p_orderId}.
NeoLoad – Correlation Examples
Scenario
Extractor
Example (Response Snippet)
Rule / Expression
Used In Request
Session ID
JSONPath
{"sessionId": "ABC123XYZ789"}
JSONPath: $.sessionId
/profile?sessionId=${p_sessionId}
Token
Regex Variable
<input name="token" value="TOKEN_123" />
Regex: value="(.*?)"
/api?token=${p_authToken}
Order ID
Boundary Variable
Your Order ID is ORD123.
LB: Your Order ID is RB: .
/details?id=${p_orderId}
Best Practices
Correlate only dynamic values (IDs, tokens, timestamps, etc.).
Use appropriate parameter type based on use case.
Validate correlation rule using "Test" option.
Use meaningful parameter names (e.g., p_sessionId, p_orderId).
Re-validate after application changes.
Common Issues
Incorrect pattern → No value captured.
Correlating static data → Script fails in real load.
Multiple values matched → Wrong value extracted.
Not using the saved parameter in subsequent requests.