Set the Recording Options under Correlations section as below:
Then start the recording (mercury tours application is used here for demo purpose):
Book the Flight. Then check the itinerary by clicking on the Itinerary button:
Sign Off and stop the recording
Following dialogue box is displayed once the recording completes:
Click on the Details down arrow to display the recording section from where the correlation left and right boundaries can be captured:
Mentioned here for reference (Line 17 – marked in yellow above):
<input type="hidden" name="userSession" value="118948.659133252zVVitcVpzftVzzzHDzHVApfcQQcf"/>
Close the Design Studio as we will be coming back to it in a short while. Reason for not using the “Add as Rule…” option right away is that the Application name will have to be selected from the existing list (shown below) whereas the rules that we want to create doesn't specifically belong to any of the listed applications.
So, First we will create an application as shown in below step and then come back to the design studio to create the rule against our newly created application. Launch the recording options and create the application with user defined name, say, mercury
Select Mercury application and click on New Rule button on the right. Then enter the below details:-
Please note that the second dialogue box (Advanced Correlation Properties) in the above snapshot comes upon clicking the Advanced… button. Click on Test… button once the rule has been created and validate the created rule as shown below:
Now, Launch Design Studio available under Design menu option (this is the same screen that gets generated once the script is freshly recorded)
Click on Replay&Scan button. The rule(s) that we created in the above steps will now be visible in the Design Studio, as shown below:-
Select the Rule and Click on Correlate. The Status column should now show status as applied.
Kudos!! You have created a correlation rule and applied it successfully. In a similar fashion, remaining rules can be created.
How to create a correlation rule in Loadrunner
Suppose you are working in a web application and it has 10 business scenarios to be scripted as part of your performance testing. There is a correlation for session id which will be used in all the scenarios. In this case, we do not need to spend time to correlate the session id in each scenario. Instead, we can create the correlation rule and the rest will be taking care by VuGen while recording. Lets see how are we going to create the correlation rule in VuGen. Consider that we are working in Mercury Web Tours application. Pre-requisite: You know the left and right boundary for the session ID. Step 1: Open the recording option -> Correlation -> Check "Enable correlation during recording"
Step 2: Click on New Application and enter the name of the application. In our case, its "Mercury" Step 3: Select Mercury in the left panel and Click on New Rule. Then enter the rule name "Session ID". In the right hand side, you need to update the left and right boundary value. Also provide the correlation variable name. In our case, its "Param_SessionID". Step 4: Click on Advance button. Check "Replace with parameter only for exact parameter". Then click on OK. Step 5: Start recording the business flow. Once the recording is done, check the script. VuGen automatically done the correlation for Session ID and replaces all the occurrences.
It's over. Simple, Isn't it? In Summary, You can create "N" number of rules under the application. So that VuGen will automatically correlated based on your rules placed under the application.