Thursday, February 10, 2022

Check Points (Validations)

 Sample Script :-

web_reg_find("Text=bing","SaveCount=welcome",LAST);

lr_start_transaction("Google_com");

web_url("Google.com",
"URL=http://www.Google.com",
"TargetFrame=",
"Resource=0",
"Referer=",
"RecContentType=text/html",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);

if((atoi(lr_eval_string("{welcome}"))>0)&&(HttpRetCode==200)) {
        lr_end_transaction("Google_com", LR_PASS);
   } else {
        lr_error_message ("Google_com failed with status code,%d", HttpRetCode);
        lr_end_transaction("Google_com", LR_FAIL);
   }
Q387. The users are login to the application . If user is successfully logged in then only the page is redirect to next page otherwise again user has to perform same login transaction?
Answer:
I will insert the text verification function web_reg_find to know whether the user logged in to the application or not .
After that using If else and strcmp functions and using user defined function I will complete this scenario.
Syntax:
            web_reg_find(“text=welcome”,”savecount=textcount”,LAST);
            if (strcmp(lr_eval_string(“{textcount}”),==0)){
                lr_output_message(“the login is failed”);
                login();
            } else {
                lr_output_message(“the login is successful”);
            }
Q. 33 What are the functions of content check?
Ans: LoadRunner content check functions are:
        web_reg_find()
        web_global_verification()
        web_image_check()
Q. 34 Which is a deprecated function of content-check?
Ans: web_find()
Q383. How to know that whether a file is uploaded or not?
Answer: once the file is uploaded immediately the text will appear like the file successfully uploaded . So using the text verification function web_reg_find() we can verify either the file was uploaded or not.
Q343.How to know that how many times a text is present in the response?
Answer:
To very whether a particular text is present in the response or not for that we will use web_reg_find () function . In this function if we use save-count argument that will tell you that how many times that text is present in the response.
Syntax:
web_reg_find (“text”,”savecount=count”,LAST);
Save count let you know how many times a particular text is present in the response.
Q :- Assume that you are working for a school application , once the exam result was released. How to know how many students are passed and how many are failed in a particular subject ?
Answer: I will insert the text verification function web_reg_find();
                web_reg_find(“text=pass”,”savecount=passed”,LAST);
                web_reg_find(“text=failed”,”savecount=failed”,LAST);
once the script is replied then
Passed_count and failed_count let you know how many students are failed and how many are passed in the results.
Q263. You have an application which shows the exam results of the student. Corresponding to name of each student its mentioned whether he passed or failed the exam with the label of “Pass” and “Fail”. How will you identify the number of passed and failed student in VuGen script?
Answer: For this text check is used for the web page for the text “Pass and “Fail”. Through the function web_reg_find, we can capture the number of texts found on the web page with the help of “SaveCount”. SaveCount stored the number of matches found. For example-
web_reg_find("Text=Pass","SaveCount=Pass_Student", LAST);
web_reg_find("Text=Fail", "SaveCount=Fail_Student",LAST);

No comments:

Post a Comment

Thread

Native Thread Demon Thread Non-Demon Thread Native Thread: - Any Method/Thread which is mapped to OS is called Native Thread or Method. Demo...