Scripting (Correlation)

Correlation:

Correlation is the concept to handle the dynamic values which are generating from server side.(Or)
Dynamic input to the server. You can conduct the correlation in 2 ways:
1. Auto Correlation.
2. Manual Correlation.

1. Auto Correlation:
Automatically handle the dynamic values.
Process:
 Auto correlation process after 11.5 version
1) Record the script.
2) Replay the script (It’s not mandatory from LR 11.5 version).
3) Click the design studio.
4) Choose the dynamic value.
5) Click on “Correlate button”.
From the above steps, this will create a function & automatically substitute the dynamic value.
 Auto correlation process before 11.5 versions.
1) Record the script.
2) Replay the script at least once.
3) Click on “Correlate button”.
4) Choose the dynamic value from correlate log.
5) Click on “Correlate button”.

Note:A design studio or correlation log compares record time response with replay time response dump the differences into the correlation log or design studio.

2. Manual Correlation
Manually we have to handle the dynamic values. Whatever the steps performed by
autocorrelations steps will be performed manually.

Process:
Step1: How to identify the dynamic values in a script?
Sol: Record the same business scenario twice with 2 sets of data & compare both of them using “beyond-compare” or “www.text-compare.com” or Tools “Windiff” (default).
Which values reported differently those values will be considered as dynamic values.

Note:
Which values are not entering through keyboard & which values are chosen from the application,
those values will be considered as dynamic values.

Step2: How to identify the left text & right text for a dynamic value?
Sol: web_reg_save_param(“parameter_name”,”lb=”,”rb=”,LAST);
 Copy the dynamic value.
 Go to generation log identify first occurrence of the dynamic value.
 Copy the left text & right text of the dynamic value.
Step3: Where to write the function?
web_reg_save_param(“parameter_name”,”lb=userSession” value=” ”,”rb=”/>”,LAST);
Sol1: Execute the script in full mode (F4LOGExtended LogEnable All Options). Identify the dynamic value based on the left boundary or right boundary in Replay log. Double click on the same line which will assist you to where to write the function or for which request the dynamic value was generated.
Sol2: (Not recommendable for web tours) once you identified the dynamic value in generation log place the cursor on the same line and search for “web_” or “ENDED” then copy the request and search for the same in script. On top of the same request u can place the function.
NOTE: Generation log contains response and request which never change.
Step4: Substitution
Sol: You can substitute the parameter name where ever the dynamic value is present in script using control+H.


Correlation Function with all Arguments

1. ORD:
ORD stands for “Occurrence”.
By default ORD=1.

Ex:
Ord=10 stands for 10thoccurrence.
Ord=ALL stands for captures all values based on LB & RB.
Whenever you written ORD=ALL your parameter become an Array. It holds all
the values with the name of parameter-1, parameter-2 & parameter-N.
Note:
Variable_count let we know the length of an Array.

2. Save Length:
Allow you to capture specific no. of characters from dynamic value based on LB and RB.
Ex: savelen=3
By default savelen=”-1”.

3. Save offset:
It will specify the no. of characters it supposed to skip from the dynamic value.
By default saveoffset=”0”.
EX: saveoffset=3 (It skips 3 char)

4. Not found:
By default notfound=”error”.
If the either LB or RB is not present in the response script will through the error like “No match found for the requested parameter”.
notfound=”warning”.
If you would like to continue the script execution, even LB or RB is not available in the response you have to use warning.

5. Search:
It is an optimization technique. This will instruct the user to search for LB & RB in a
specific location.
By default search=ALL.
Ex: Search= headers: - it will search for LB n RB in only on header
Ex: Search= Body: - it will search for LB n RB in only on body

6. RelframeID:
This is also optimization technique. Specifying to capture the dynamic value from a specific frame.
Ex: RelframeID=1.2.1

HTTP Status Codes:
100 - Request successfully delivered.
200 - Response received successfully.
300 - Received response but it was redirected response.
400 - Invalid request.
500 - Application itself not available.

7. Ignore Redirection:
By default ignore redirection= YES
Instructing correlation function to capture dynamic value from a redirected response or not.


8. Convert:When ever the dynamic value is recorded in the format of URL and the captured value in the format of HTML. Use convert argument to convert HTML to URL but did not “Vice-Versa”.
Ex: Convert= HTML_TO_URL

HTML - Hyper Text Markup Language
XML - Extensible Markup Language



Regular Expressions:

Whenever you have dynamic LB & RB, we can use regular expressions. This function works on
expression but not on boundaries.
Steps to construct regular expressions:
Step 1: Copy the LB & RB from generation log.
Step 2: Construct the expression.
Step 3: Validate inwww.rubular.com
Step 4: Write web_reg_save_param_regex() function.

Example:
web_reg_save_param_regex(“parameter name = reg_exp”,
“regex=name =\” u[a-z]er[A-Z]ession\” \\value=\”(.*?)\” , LAST);
u[a-z]er[A-Z]ession  Function searches for userSession based on this regular expression.
[a-z]  Skips any single character in the range a-z
[A-Z]  Skips any single character in the range A-Z

No comments:

Post a Comment