Checkpoints

Verification points/checkpoints:

We have to verify whether we received proper response or not using below techniques
1) Text verification points
2) Image verification points
3) Response size
4) HTTP status codes


Text verification points:

web_reg_find(“text=xyz”,LAST);
Note 1: Which request you are planning to verify, on top of the request you have to write this function
Note 2: web_reg_find is a registered function. You have to write on top of request for verification
Note 3: Preferrably use static text verification even you can use dynamic text for verification.

Checkpoint function:
web_reg_find(“text=welcome”,”savecount=xyz”,LAST);
After request, we have to write
If (strcmp(lr_eval_string(“{xyz}”),”0”)==0)
{
Lr_output_message(“text check failed”);
}else{
Lr_output_message(“text check passed”);
}

Image verification:

It will verify the response based on image
Syntax: web_image_check(“xyz”,”SRC=c://image.gif”);
web_image_check is a non-registered function. We have to write after the request to make it work. You have to enable option “enable text and image verification” in runtime settings.


HTTP status codes

 web_get_int_property():
Using this function, you can verify response whether it is proper or not based on HTTP status codes and download size
Syntax:
int HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
lr_output_message(“%d”, HttpRetCode);
if(HttpRetCode == 200)
{
lr_log_message(“Script passed”);
}else
{
lr_log_message(“Script failed”);
lr_abort();
}

Response size

HttpResponse = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
lr_output_message(“%d”, HttpResponse);
if(HttpResponse == 200)
{
lr_log_message(“Script passed”);
}else
{
lr_log_message(“Script failed”);
lr_abort();
}



No comments:

Post a Comment