Thursday, July 21, 2016

Performance teting Page validation-Web_reg_find Examples in Loadrunner Vugen

Page Validation

Page validation is to verify the static text of a particular page.
When you run the script with multiple users, it is not possible to verify whether all the pages are successful or not using the browser display or runtime viewer.
To overcome this problem we can verify the static text of a particular web page to see if web page is properly displayed. If the static text is found it is considered as successful, otherwise it is considered as failed.
The function web_reg_find is used to verify the expected page by searching static text. The -attributes of this function are Text, Search, Save Count and Fail. Text is mandatory attribute and other attributes are optional.
Web_reg_find (“Text=static Text”);

Attribute List
The attributes are passed in Name=Value pairs, for example: "Text=string". Either Text, or TextPfx and TextSfx is required. The rest of the attributes are optional.
Text: The text string to search for. Text is a non–empty, null–terminated character string. You can further customize your search by using text flags.
Text searches for a known string. TextPfx and TextSfx are used when the string is not known in advance, but you know what strings will precede and follow it. For example, when a user is issued a user name, the server may return "Your new user name is <user name>". The user name changes, but to confirm that a name was issued it is sufficient to confirm that there is some string preceded by "Your new user name is” and followed by a ".".
You must specify the following two attributes if you do not specify Text. You can further customize your search by using text flags with these attributes.

TextPfx: The left boundry for the search. This is the text immediately preceding the text string for which you are searching.

TextSfx: The right boundry for the search. This is the text immediately following the text string for which you are searching.

Search: The scope of the search—where to search for the string. The possible values are Headers (search only the headers), Body (search only the Body data), Noresource (search only the HTML body, excluding headers and resources), or ALL (search body, headers, and resources). The default value is BODY.

SaveCount: The number of matches that were found stored in a parameter.
The SaveCount attribute assigns the number of matches that were found to a parameter. To use this attribute, specify "SaveCount=param". When the check is performed, param is assigned a null–terminated string representing a numerical value.
When the SaveCount argument is used, and the Fail argument is not used, the check does not fail whether the text is found or not. To check whether the text has been found, examine the value of the SaveCount parameter. If it is "0", the string was not found.
If both SaveCount and Fail are used, the Fail handling option specified works together with the SaveCount. Thus, if SaveCount is used with "Fail=NotFound" and the text is found, the SaveCount parameter is assigned the number of occurrences and the check succeeds. If the text is not found, the SaveCount parameter is assigned "0" and the check fails. Of course, if the text is not found and "Fail=NotFound" has been specified, the value "0" of the parameter is only useful if the run–time setting Continue on error is selected.
The value assigned to the parameter is retained between iterations until the first action function following the web_reg_find of the next iteration. Once the script perfoms the first action function following the web_reg_find of the next iteration, the count is updated. Alternatively, you can use the lr_save_string function to change the value of the parameter at the end of the current interation—for example, with lr_save_string ("0", "Count").
Fail: The handling method that sets the condition under which the check fails.
Fail can be either "Found" or "NotFound". The default is NotFound.
"Fail=NotFound" indicates that an error occurs when the text is not found. You use NotFound when searching for the text you expect to find if the Web request succeeds.
"Fail=Found" indicates that the check fails when the text is found. You might use Found, for example, searching for the word "Error". If you find "Error", the Web request did not succeed, and you want the check to fail.
When "Fail = Found" is specified with TextPfx and TextSfx and the left and right boundaries are found more than once, each match is issued as an error up to the maximum number of errors configured in the Run-Time Settings > Preferences > Advanced Options. Subsequent matches are logged as informational messages.
For information about using Fail with SaveCount, see SaveCount.
Some of the examples are as follows
web_reg_find (“Text=Siva”, LAST);
web_reg_find ("Text=Siva", "SaveCount=Siva_Count", LAST);
web_reg_find ("Text/IC=Siva", "Fail=Found", LAST);
web_reg_find ("Text/IC=Kota", "Fail=Not Found", LAST);

No comments:

Post a Comment