Thursday 3 May 2018

Page Validation using Load Runner - Part1- Chapter11



  • Page validation is nothing but verifying, that the expected web page is loaded or not.
  • This can be achieved using load runner function "web_reg_find".
  • If expected text is not found in the response body of the request or in webpage, then it will fail the transaction and stop the script run.
  • web_reg_find function should be placed before web requests.
  • The important attributes of web_reg_find are "Text=", "SaveCount=", "Fail=", "Search=" and "RealFrameID".
    • "Text=" : In this attribute, we will keep the particular text from the web page which should be validated. Example: web_reg_find("Text =Welcome Yasir"
    • "SaveCount=" : SaveCount plays a vital role in page validation. The notable thing is, if the SaveCount attribute is specified in web_reg_find, though the expected text is not found, the transaction will pass and the script will run till the end of line. If the log is enable run time settings, then the number of occurances of the expected text will be printed in output under save count parameter name. Example: "web_reg_find("Text=Welcome Yasir", "SaveCount=TxtChk_Login"  where TxtChk_Login is a user-defined text to store the number of occurances of the expected text "Welcome Yasir".
    • "Search=": In this attribute, we will specify that the search should be made on body or request header or response headers or ALL. Example: web_reg_save_param("Text=Welcome Yasir", "SaveCount=TxtChk_Login, "Search=Body",LAST"). LAST is the load runner default attribute which denotes till last line of the request, the search should be made.
    • "RealFrameID=": RealFrame id attributes are used if the expected text is not able to find by just keeping "Text=Welcome Yasir". We can check the response body and check for the RealFrameID, in which the particular text is exist and then we can specify the same. Important thing to not about RealFrameID is as per load runner limitation, RealFrameID is not supported in GUI level scripts. The minimum/default value is 1 and  zero is not permitted. If you are not aware on which frame the expected text exists, you can keep attribute value as "ALL". Example.web_reg_find("Text=Welcome Yasir", "SaveCount=TxtChk_Login", "RealFrameID=ALL", LAST);
    • "Fail=" : This attribute can be used to check two different conditions.
      • If the expected text is found, then pass/faill transactions
      • If the expected text is notfound, then pass/fail the transactions. 
        • Example: web_reg_find("Text=Welcome Yasir", "SaveCount=TxtChk_Login", "Search=Body", "Fail=NotFound", LAST);
        • Example: web_reg_find("Text=Welcome Yasir", "SaveCount=TxtChk_Login", "Search=Body", "Fail=Found", LAST);
      • "Fail=Found" can be used to check if any error message or error code is received from the server response, and the respective transaction can be made to fail.
        • Example: web_reg_find("Text=HTTP Internal Server Error 500", "SaveCount=TxtChk_Login", "Search=Body", "Fail=Found", LAST);
    • Stay tuned for more learnings.

No comments:

Post a Comment

Correlation Using Load Runner - Part1 - Chapter13

Correlation General Description : Capturing Dynamic values from the preceding requests and substituting in the post request.  Exam...