Correlation is process to handle the dynamic values which are generated from server.
or
It is a process to capture the dynamic value, store the dynamic value in a parameter and passing it into subsequent request.
For sever generated values , drop down list and radio button list, we have to do correlation based on the requirement.
Example for Dynamic values:
Dynamic values in .Net Application:
- View State
- Event Validation
- Event Generator
- Event Trigger
Dynamic values in java Application:
- Session id
- Jsession id
Authorization Dynamic values:
- Token
- Id Token
- Bearer Token
- UserToken
- Csrf-token
Types of Correlation:
There are 2 types of correlation
- Auto Correlation
- Manual Correlation
Auto Correlation: Automatically handle the dynamics in script by the design studio.
Process to do Autocorrelation:
- Identify and select the dynamic value
- Right click on dynamic value
- Select dynamic values and click on Correlation selection
- Go to Correlation Definition and select the type as boundary based
- Click on correlate button.
web_reg_save_param_ex(
"ParamName=C_userSession",
"LB=name=\"userSession\" value=\"",
"RB=\"/>\n<table border",
SEARCH_FILTERS,
"Scope=Body",
"IgnoreRedirections=No",
"RequestUrl=*/nav.pl*",
LAST);
- Identify the dynamic value in script
- Copy the dynamic value
- Go to code generation in output pane and search for the dynamic value
- Identify the left and right boundary of the dynamic value
- Run the script with extended log in full mode
- Go to reply log in output pane
- Search for dynamic value with either unique left boundary or right boundary
- After Identifying the dynamic value, just double click on dynamic value then that will show where to write the correlation function or for which request the dynamic value has been generated.
- Write the correlation function on top of the request in script.
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>",LAST);
web_url("WebTours",
"URL=http://localhost:1080/WebTours/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
- Identify the dynamic value in script
- Copy the dynamic value
- Go to code generation in output pane and search for the dynamic value
- Identify the left and right boundary of the dynamic value
- Place the cursor on dynamic value
- Go to search box and type .inf (dot inf) or web_ or snapshot then click on search, that will show for which request the dynamic values has generated.
- Write the correlation function on top of request in script.
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>",LAST);
web_url("WebTours",
"URL=http://localhost:1080/WebTours/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
- Go to Tools in first script
- Click on Compare
- Navigate to Compare External File
- Select Action.c of the second script
- WinMerge shows the comparison of two scripts then we can identify the dynamic values in script.
Correlation Functions:
Web_reg_save_param
Web_reg_save_param_ex
Web_reg_save_param_regex
Web_reg_save_param_json
Arguments of web_reg_save_param:
We have two type of attributes
1. Mandatory Arguments
2. Optional Arguments
1. Mandatory attributes
1. Parameter: indicates the name of the parameter used to store the dynamic value.
2. LB : indicates the left boundary of the dynamic value
3. RB: indicates the right boundary of the dynamic value.
4. LAST: indicates the end of the arguments.
2. Optional Arguments
5. ORD: Indicates the occurrences of dynamic value.
ORD=1 , Indicates the first occurrence of dynamic value
ORD=10, Indicates the 10th Occurrence of dynamic value
ORD= all, save the all the values in correlation parameter like an array and shows the count.
7. SaveOffset: It is used to skip
the particular number of characters from main string (dynamic value). It
is an optional argument, the offset value must be non-negative. The default
value is 0.
Action.c(35): Notify: Saving Parameter "C_UserSession = 2.82073714".
8. Search: where to search for dynamic value. Dynamic values either present in response header or response body. The default value is all.
Search= Headers
Search= Body
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>","Search=body",LAST);
9. Notfound: if the dynamic value is not found, it will generate empty string.
Notfound =error is the default value, it causes an error when the boundary is not found in correlation function.
Notfound=warning , it will not through an error, if the boundary is not found, it sets the parameter count to 0, and continues script execution.
Example:
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>","Search=headers","Notfound=warning",LAST);
10. Convert: It is used to convert the Captured dynamic value into required format.
For example if we are capturing the dynamic in HTML format and it is required submit in URL format,
HTML_TO_URL: convert HTML–encoded data to a URL–encoded data format
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>","Convert=HTML_TO_URL",LAST);
For example if we are capturing the dynamic in HTML format and it is required submit in Text format,
HTML_TO_TEXT: convert HTML–encoded data to plain text format
web_reg_save_param("C_UserSession","lb=userSession\" value=\"","rb=\"/>","Convert=HTML_TO_TEXT",LAST);
11. IgnoreRedirections:
If
"IgnoreRedirections=Yes" is specified and the server response is
redirection information (HTTP status code 300-303, 307), the response is not
searched. Instead, after receiving a redirection response, the GET request is
sent to the redirected location and the search is performed on the response
from that location.
This attribute is optional. The
default is "IgnoreRedirections=No"
No comments:
Post a Comment