Skip to content
Speak to an Expert

Correlation in LoadRunner: How to Handle Dynamic Values in VuGen

Connect

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 operationOriginal recordingReplay without correlationReplay with correlation
Create shopping cartCART_1025CART_2048CART_2048
Retrieve cart detailsCART_1025CART_1025CART_2048
Proceed to checkoutValid cartOutdated cartValid 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:

  1. Record a business process twice with the same inputs.
  2. Using text-diff, compare the scripts and/or server responses.
  3. Seek out fluctuating values that emerge in later requests.
  4. Run the script and check the logs for errors or unexpected responses.
  5. 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 methodHow it works
Rule-based correlationUses predefined or custom rules to identify dynamic values.
Recording-based correlationIdentifies potential dependencies between recorded responses and subsequent requests.
Replay-based correlationExamines replay results to identify values that may be causing script failures.

How to Perform Automatic Correlation in LoadRunner

Follow these steps in VuGen:

  1. In the Recording options > Correlations > Configuration tab:
  2. Run a Rules Scan, a Record Scan, and a Replay Scan.
  3. Review the suggested correlations in Design Studio.
  4. Select the relevant values and click Correlate.
  5. 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 functionWhen to use it
web_reg_save_param_exWhen values appear between identifiable text boundaries.
web_reg_save_param_jsonWhen the application returns JSON responses.
web_reg_save_param_regexpWhen response patterns require regular expression matching.
web_reg_save_param_xpathWhen working with XML responses.
web_reg_save_param_attribWhen 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.

FactorAutomatic correlationManual correlation
Scripting effortGenerally lowerGenerally higher
Value identificationAutomated scanningManual response analysis
AccuracyDepends on detection rulesDepends on extraction logic
ControlConfigurableDirect control
Best suited forCommon response patternsComplex 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.

ProblemHow to resolve it
Dynamic value not foundCheck whether the extraction function is registered before the request returning the value.
Incorrect value capturedRefine the left and right extraction boundaries.
Value changes with every requestCapture the new value whenever the server generates it.
Value exceeds the parameter length limitAdjust 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.

MetricResult
Total checkout requests1,000
Completed orders750
Rejected orders250
HTTP-level success rate100%
Actual transaction success rate75%

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:

  1. Make the adjustment on one dynamic variable at a time; replay the script after each adjustment.
  2.  Pick parameter names that clearly express the function of the extracted value.
  3. Try to keep extraction boundaries small, stable, and adequately precise.
  4.  If application changes make the extraction logic unusable, record the impacted workflows again.
  5.  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.

Share this article

About the author

Kashaf Fatima

Published by Kualitatem Performance Testing

Explore more articles

Let’s Build Your Success Story

Our experts are all ready. Explain your business needs, and we’ll provide you with the best solutions. With them, you’ll have a success story of your own.
Contact us now and let us know how we can assist.