Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*

Verification's and Error Handling

Verification points must be inserted into the scripts to verify the application being tested with the load.

Verification function that are used in our application are:  Web_reg_find, web_reg_save_param

These verification should be outside towards the end of the transaction.

         Login – whenever there is a login, verification points must be added to verify that the user logged in correctly.
         Update Transactions – transactions that update the database must be verified that they are successful.
         Each page should be verified using Web_reg_find function

Using Web_reg_find for verifications.

Example:
web_reg_find("Text= Main Package","SaveCount=Verify_Count1",LAST);

Verification:
if (strcmp(lr_eval_string("{Verify_Count1}"),"0")==0)
{
lr_end_transaction("AddMainPackage", LR_FAIL);
 lr_error_message("Iter %s: Add Main Package for Customer '%s' & UserName '%s' Failed!", lr_eval_string("{Iter}"), lr_eval_string("{CustomerName}"), lr_eval_string("{LoginID}"));
return 0;
}
Else
{
lr_output_message("Iter %s: Add Main Package for Customer '%s' & UserName '%s' Succeded!", lr_eval_string("{Iter}"), lr_eval_string("{CustomerName}"), lr_eval_string("{LoginID}"));
}

Using Web_reg_save_param for verifications.

Example:
  web_reg_save_param("OrdersJan",
                        "LB=OrdersJan:",
                        "RB=\"",
                        "NotFound=EMPTY",
                        LAST);

web_reg_save_param("OfferNode",
"LB=type=\"checkbox\" value=\" OfferJan:",
                        "RB=\"/>",
                        "NotFound=EMPTY",
                        LAST);
Verification:
if ((strcmp(lr_eval_string("{OrdersJan}"),"")==0)||
(strcmp(lr_eval_string("{OfferJan}"),"")==0)){
lr_end_transaction("NewConnect", LR_FAIL);
lr_error_message("Iter %s: Select New order Customer '%s' & UserName '%s' Failed!", lr_eval_string("{Iter}"), lr_eval_string("{CustomerName}"), lr_eval_string("{LoginID}"));
return 0;
}
Else
{
lr_output_message("Iter %s: Select New order Customer '%s' & UserName '%s' Succeded!", lr_eval_string("{Iter}"), lr_eval_string("{CustomerName}"), lr_eval_string("{LoginID}"));
}

         The verification should provide as much info on the problem accrued, for example printing the user details, order number that failed.
lr_error_message("Order Failed with User : %s ",lr_eval_string("{CurrUserID}"));

         A transaction must be ended by strictly specifying success or failure (LR_PASS, or LR_FAIL). Automatic detection must not be used (LR_AUTO).


Comments

Post a Comment

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Vmstat Output explained