Continuing correlation topic, now we arrived at Manual Correlation. You have already learned about the correlation basics and automatic correlation in my previous blogs. The manual correlation is a method to identify the dynamic value which needs manual effort. Although 60-90% dynamic values (sometimes 100%) can be correlated using automatic correlation (it is a generic statement; not applicable to all protocols). Automatic correlation is a rule-based approach and dynamic values are identified based on the defined rules. But some times the defined rules do not satisfy the correlation condition and unable to recognise the dynamic value. In that case, manual correlation of dynamic values in LoadRunner comes in picture.
If you use automatic correlation to debug the script using any of the methods (Rule, Record and Replay) and still the script is failing then it implies that you have to carry out manual identification of those dynamic values which cause the failure of the script.
There are two methods which help to carry out the manual correlation in LoadRunner which are:
- Using WDiff (By comparing two scripts for identical flow)
- Using Replay and Generation Log
a. Script Comparison:
The first method is the comparison method in which two scripts having identical flow are compared and the difference in the values are captured and correlated by adding correlation function. In this method, you have to record the same script twice and then compare both the scripts.
LoadRunner provides a utility in VuGen called ‘WDiff’ which helps to compare the content of scripts and highlights the differences.
How to compare two identical flow scripts in LoadRunner to find out dynamic values?
1. Record a script and save it (say primary_script).
2. Record the same flow in another script and save it (say secondary_script).
3. Select Tools -> Compare -> either “Select Folder to Compare” or “Compare to External Folder”. The differences in the script are highlighted (in Yellow).
4. Review the differences and identify the appropriate dynamic value which requires correlation.
5. Identify the string that is immediate to the left of the dynamic data. This string defines the left boundary of the dynamic data.
6: Identify the string that is immediate to the right of the dynamic data. This string defines the right boundary of the dynamic data.
The right and left boundaries should be as unique as possible to better locate the strings. If you are comfortable with Regular Expression then write a unique token to capture the dynamic value.
7. Go to the script and right-click before the step/function that contains the dynamic data.
8. Hover Insert -> New Step
Press ‘Alt + Insert’
9. ‘Steps toolbox’ appears in the right.
10. Search using the keyword ‘web_reg_save_param‘ and select ‘web_reg_save_param’
11. Fill the fields with the parameter name, left boundary, right boundary, save offset as per your requirement
12. Click “OK”. The correlation function will be inserted into your script
2. Via Replay/Generation Log:
In this approach, you need to find the dynamic values in the generation and replay-log and compare them. If values are different then you have to apply correlation. As stated earlier, you may need to search and correlate hash strings, random strings, session ID, current date & time and so on. Follow the below given to apply this method:
a. Replay the script by enabling extended logs (Runtime Settings -> Log -> Extended Logs).
b. The script may fail due to dynamic value issue.
c. Identify the dynamic parameter values passed in the request where the script is failing and copy the name of the parameter (or HTML tag) of the same value.
d. Search the value and parameter (or HTML tag) in the generation log where it appears first time in the response from the server.
e. If the response in generation log contains a different string within the same boundaries as the original suspected string then the string requires correlation.
f. Follow the same steps from step 5 to add the correlation function in the script.
You may be interested:
1 thought on “LoadRunner Manual Correlation”
The error is in web_custom_request(“some alphanumberic-0/1_0/1”)