Correlation in LoadRunner: How to Handle Dynamic Values in VuGen
Summary
Correlation in LoadRunner helps performance engineers capture and reuse dynamic server values to ensure accurate script replay and reliable performance testing results.
- Correlation handles dynamic values such as session IDs, authentication tokens and transaction identifiers.
- Automatic correlation in VuGen identifies common dynamic values and reduces scripting effort.
- Manual correlation provides greater control over complex request dependencies using functions such as web_reg_save_param_ex.
- Parameterization introduces different test inputs, while correlation handles server-generated values.
- Common correlation issues include incorrect extraction boundaries, outdated tokens and parameter length limitations.
- Application responses and database records help verify actual business transaction outcomes.
- Proper correlation and script validation improve the reliability of performance metrics, supporting informed release and infrastructure decisions.
Editorial summary · Read the full guide below
A load test can report successful transactions as well as acceptable times and stable throughput while the underlying business processes are failing. This situation creates a problem with release decisions. For the performance testers, it raises a more fundamental question: Are the scripts accurately reproducing real user activity?
A single outdated session ID or authentication token can compromise the reliability of an entire testing scenario. Correlation in LoadRunner helps address this problem by capturing the dynamic server values and reusing them throughout script execution.
In this guide, you will be able to learn the following things:
- What LoadRunner correlation is and why scripts fail without it
- How to identify the dynamic values in server responses.
- How to perform automatic and manual correlation in VuGen
- How to capture and reuse the session ID with a practical scripting example.
- How to troubleshoot correlation errors and validate the scripts before generating load.
The objective is quite simple: Ensuring that your load tests measure how the application performs when users complete actual business transactions.
What Is Correlation in LoadRunner and Why Do Scripts Fail Without It?
Every time a user logs into the application, adds the product to the cart, or initiates the payment, the server may generate new values. These include the session IDs, authentication tokens, timestamps, hidden form fields, and transaction IDs
VuGen captures these values during the recording. The problem arises during the replay when the application generates new values, but the recorded script continues using the old ones.
Example: Testing an E-commerce Checkout
Think of a performance tester that records the entire checkout process of an online store. The application generates a unique Cart ID when the customer adds a product.
During the next replay, a new shopping cart is created. However, the recorded checkout request still references its original cart.
| Business operation | Original recording | Replay without correlation | Replay with correlation |
|---|---|---|---|
| Create shopping cart | CART_1025 | CART_2048 | CART_2048 |
| Retrieve cart details | CART_1025 | CART_1025 | CART_2048 |
| Proceed to checkout | Valid cart | Outdated cart | Valid cart |
The application may return an empty cart or reject the checkout request.
Correlation captures the newly generated cart ID and passes it into the checkout request. Each virtual user can then interact with the correct shopping cart throughout the test.
How to Find Values That Need Correlation in VuGen
Check if there are any outdated server-generated values in the script being recorded before reporting a replay failure as an application defect.
The points below describe how performance testers can actually identify them:
- Record a business process twice with the same inputs.
- Using text-diff, compare the scripts and/or server responses.
- Seek out fluctuating values that emerge in later requests.
- Run the script and check the logs for errors or unexpected responses.
- Use the correlation scan in VuGen Design Studio.
Investigate, in particular, for authentication failures, unexpected redirects to login pages, and transactions that did not get recorded.
A changing value is considered to need correlation if it is used in a subsequent call.
Automatic Correlation in VuGen
Looking manually through hundreds of server responses can take up a large chunk of a scripting session. The process is much easier using VuGen, which can pinpoint potential dynamic values by:
It uses three detection methods.
| Correlation method | How it works |
|---|---|
| Rule-based correlation | Uses predefined or custom rules to identify dynamic values. |
| Recording-based correlation | Identifies potential dependencies between recorded responses and subsequent requests. |
| Replay-based correlation | Examines replay results to identify values that may be causing script failures. |
How to Perform Automatic Correlation in LoadRunner
Follow these steps in VuGen:
- In the Recording options > Correlations > Configuration tab:
- Run a Rules Scan, a Record Scan, and a Replay Scan.
- Review the suggested correlations in Design Studio.
- Select the relevant values and click Correlate.
- Examine the extraction logic and use the Replay & Scan to do the last of the work.
Auto-correlation is effective when the application follows common patterns for passing server values.
However, custom authentication mechanisms and complex API responses may require manual analysis. Review the suggested correlations before applying them to your scripts.
For additional configuration details, refer to the official VuGen automatic correlation documentation.
Manual Correlation in LoadRunner Using web_reg_save_param
Manual correlation becomes useful when VuGen misses a dynamic value or captures the wrong one.
This often happens in applications where several requests depend on the outcome of an earlier transaction. Performance engineers can manually define which value to capture and where to reuse it.
While older LoadRunner scripts use web_reg_save_param, OpenText recommends web_reg_save_param_ex for boundary-based extraction.
OpenText Correlation Functions explains the appropriate function depends on how the server returns data.
| Correlation function | When to use it |
|---|---|
| web_reg_save_param_ex | When values appear between identifiable text boundaries. |
| web_reg_save_param_json | When the application returns JSON responses. |
| web_reg_save_param_regexp | When response patterns require regular expression matching. |
| web_reg_save_param_xpath | When working with XML responses. |
| web_reg_save_param_attrib | When extracting HTML attribute values. |
LoadRunner Correlation Example: Capturing a Session ID
Consider a digital banking platform preparing for a major release.
Whenever a customer logs in, the application generates a session ID. The same identifier is used to access account balances and transaction histories.
If a recorded script continues using an expired session ID, requests may be rejected before reaching the banking application’s core processing systems.
To resolve this issue, the performance engineer locates the session ID in the server response and identifies the text surrounding it. An appropriate correlation function captures the value, which replaces the hardcoded session ID in subsequent requests.
Illustrative example of capturing and reusing a dynamic session ID in LoadRunner.
Before increasing the number of virtual users, the tester should replay the script and confirm that each user can access the intended account information.
This ensures the test measures the performance of the banking operations it was designed to evaluate.
Automatic vs. Manual Correlation in LoadRunner
Should your team rely on automatic correlation or handle dynamic values manually?
The decision largely depends on the complexity of the application and the structure of its server responses.
| Factor | Automatic correlation | Manual correlation |
|---|---|---|
| Scripting effort | Generally lower | Generally higher |
| Value identification | Automated scanning | Manual response analysis |
| Accuracy | Depends on detection rules | Depends on extraction logic |
| Control | Configurable | Direct control |
| Best suited for | Common response patterns | Complex request dependencies |
A practical approach is to start with automatic correlation and manually address any values that VuGen misses.
Regardless of the method, replay validation remains essential.
Troubleshooting Common LoadRunner Correlation Problems
If your script continues to fail after correlation, check the extraction logic before spending time recording the entire business process again.
| Problem | How to resolve it |
|---|---|
| Dynamic value not found | Check whether the extraction function is registered before the request returning the value. |
| Incorrect value captured | Refine the left and right extraction boundaries. |
| Value changes with every request | Capture the new value whenever the server generates it. |
| Value exceeds the parameter length limit | Adjust the limit using web_set_max_html_param_len. |
According to OpenText’s function documentation, the default maximum captured parameter length is 256 characters. This may need adjustment when working with longer authentication tokens.
Can a Successfully Replayed Script Still Produce Incorrect Results?
Imagine your team runs a performance test on an e-commerce checkout process. All 1,000 requests return an HTTP 200 status code.
The test appears successful until the team reviews the actual order records.
| Metric | Result |
|---|---|
| Total checkout requests | 1,000 |
| Completed orders | 750 |
| Rejected orders | 250 |
| HTTP-level success rate | 100% |
| Actual transaction success rate | 75% |
These figures represent an illustrative scenario.
Despite receiving successful HTTP responses, a quarter of the simulated customers were unable to complete their purchases.
This is why performance engineers should verify application responses and relevant database records alongside HTTP status codes.
Best Practices for LoadRunner Correlation
A script should be consistent in delivering business results before it is included as a component of an end-to-end performance scenario.
Follow these practices when preparing scripts:
- Make the adjustment on one dynamic variable at a time; replay the script after each adjustment.
- Pick parameter names that clearly express the function of the extracted value.
- Try to keep extraction boundaries small, stable, and adequately precise.
- If application changes make the extraction logic unusable, record the impacted workflows again.
- Run the script with different parameters between five and ten times, checking that the application state is as expected.
Learn how to test mobile application performance with LoadRunner.
Conclusion
Reliable results from performance testing are dependent on reliable scripts that generate those results.
You should implement automatic correlation for the typical dynamic values, and manual correlation for the more complicated request dependencies. Also, use parameterization and apply assertion logic before scaling your load test’s virtual user numbers.
Leaders of engineering teams are thus equipped to make informed infrastructure and release decisions with regard to performance data that truly represents actual users.
Frequently Asked Questions
What is correlation in LoadRunner?
Correlation in LoadRunner is a process by which dynamic values returned by a server in a response are captured and then used later in the script when making subsequent requests to the application. When a script requires interaction with dynamically generated session, transaction, or other IDs that appear in requests after being generated on the server, it will fail unless these dynamically generated values are captured and used in subsequent requests as well. This can be done through automatic correlation in VuGen Design Studio or through manual correlation using extraction functions in a script.
What is the difference between correlation and parameterization in LoadRunner?
Parameterization is supplying inputs such as usernames, passwords, and products to the application from pre-defined sets while executing the test. Correlation is capturing a token, such as an authentication ID, that is generated by the server after you supply a username and a password while executing a test.
Which function is used for correlation in LoadRunner?
Older LoadRunner scripts use web_reg_save_param for extracting dynamic values. OpenText recommends web_reg_save_param_ex for boundary-based correlation in current Web HTTP/HTML C scripts. Testers can also use web_reg_save_param_json, web_reg_save_param_regexp and web_reg_save_param_xpath, depending on the structure of the server response.
Are Scripting Issues Affecting Your Performance Testing Results?
Kualitatem performance testing services assist your engineering teams in identifying script issues, validating application functionality, and assessing performance under load conditions.