# 2.16 - Auto Correlation

Auto Correlation — Appvance IQ documentation.

# Auto Correlation Overview in AIQ

## Contents

- [How Auto Correlation Works](https://docs.appvance.net/Content/AIQ/uto_Correlation/How_it_works.htm)

Correlation is the most important aspect of scripting. It generally includes fetching dynamic data from preceding requests/calls and posting it to the subsequent requests.

Let's take an example to find out why exactly we need correlation

Suppose we have recorded a scenario in which:

- The user enters login details and click the OK button
- The home page opens and the user take further actions
 
Now, if we just playback this script, the test will fail even for a single user. This is because of the authentication mechanism used. When we log in to a website, session variables are dynamically created. These session variables are passed to the subsequent requests and help validation and authentication of the actions performed. So, one cannot just record and playback the requests having these variables.

Here, we need to correlate the web requests with the dynamic variables. And for correlation, AIQ has the feature of Auto-correlation.

## User Flow

1. Start creating the HAR functional scenario using the Scenario Builder, please refer to HTTP Proxy on how to create HAR scripts using Appvance HTTP Proxy.
2. Once created, Click play to run the scenario.
3. On the Controller page, Autocorrelation will be displayed as one of the options in the left navigation pane.
4. The user has to wait till the scenario execution is complete to work with Autocorrelation, else user will see a message telling "Please wait for the scenario execution to complete.
5. Once the scenario execution is Done, click Autocorrelation, Start Autocorrelation button will be enabled. If the tool is not able to generate any correlations, it will display a message telling, "no correlations were available for this scenario"
    
     ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/J7JnqYNXH2Fdsvao-4978e24e9391.png)
6. Click Start Autocorrelation, Depending on the number of correlations the tool generates, it might take some time to list all the correlations that are available
7. Once the autocorrelation tool identifies all the correlations, it will display the list of correlations as shown in the below screen-shot which shows Initial Request, Subsequent Request with Correlated Request with buttons to 'Accept All Autocorrelations', Accept individual Autocorrelation' and also user can 'Reject Autocorrelations'.
    
     ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/IRd7bEC19ZwsrbA2-c40add38f774.png)
8. Users can click Accept All Autocorrelation to accept all the correlations, once clicked, it will display a message telling "All auto-correlations have been processed." with a 'Save Autocorrelated Scenario' button enabled.
    
     ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/I2vz7xZYFbQVIVzF-8f4327851a5f.png)
9. Click Save Autocorrelated Scenario which will open the save dialog, User can create a new folder to save the autocorrelated scenario (scenarioname.autocorrelated.scenario) that saves along with the har script
    
     ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/DOOnHQ5mePTic9F6-f38680190815.png)
10. Go back to Scenario Builder and open the autocorrelated scenario that was created using the autocorrelation tool
11. Go to the Store panel in the left navigation pane as shown in the screen-shot below, you will notice that all the correlations will be saved
    
     ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/5sZWTaU1aGfp9qp5-397b3092ab5e.png)
12. Re-run the autocorrelated scenario to see the successful results
 
<div id="bkmrk-last-updated%3A-august">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">August 09, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>

# How Auto Correlation Works in AIQ

## Basic Example

Let’s there be a Alpha request/response Pair such that

<div class="codeSnippet" id="bkmrk-copy-request%28alpha%29-"><div class="codeSnippetBody">```
request(Alpha) = http://server/getProducts<br></br>response(Alpha) = [{productId=512,productName=“Screw”, price= “5”},<br></br>{productId=631,productName=“Hammer”, price= “10.4”} ]
```

 </div> </div>And let Beta be a request/response Pair such that

<div class="codeSnippet" id="bkmrk-copy-request%28beta%29-%3D"><div class="codeSnippetBody">```
request(Beta) = http://server/purchaseProduct?id=512<br></br>response(Beta) = …
```

 </div> </div>A correlation could be seen here in the productId from the request of Alpha which is used in the response of Beta. Highlighting the correlation.

<div class="codeSnippet" id="bkmrk-copy-response%28a%29-%3D-%5B"><div class="codeSnippetBody">```
response(A) = [{productId=512,productName=“Screw”, price= “5”},<br></br>{productId=631,productName=“Hammer”, price= “10.4”} ]<br></br>request(B) = http://server/purchaseProduct?id=512
```

 </div> </div>## Supported Formats 

- HTML
- XML
- JSON
- CSV
 
## Features and Best Practices 

- When working with autocorrelation, Always check to Execute all HAR calls (even after a failure) in the Options panel of Scenario Builder under HAR Script Options.
- Never check 'Mark each request as a step' (it will make autocorrelation fail sometimes).
- Autocorrelation rejects unnecessary correlations.
- Autocorrelation makes har scripts Less brittle.
- Autocorrelation cleans duplicated correlations.
- A1 -- &gt; B
    
    A2 -- &gt; C
    
    A1 == A2
    
    Automatically transform A2 to A1 (Shrinks memory footprint)
    
    A1 -- &gt; B
    
    A1 -- &gt; C
- 'Show headers, requests, and responses in each test case execution output' option is useful for the Development team to debug, similar to the designer script debug option. Please mark this option if (and only if) you want the development team to review autocorrelation.
- Autocorrelation supports URLs with or without port, the below 2 URLs are handled the same way.
    
    
    - https://appvance.ci.cloudbees.com/login.html
    - https://appvance.ci.cloudbees.com:443/login.html
 
<div id="bkmrk-last-updated%3A-august">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">August 09, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>