Wednesday, May 6, 2015

How to calculate doc download time in LoadRunner



Lets says that we have a document in one of the pages that we record in VuGen and we have to capture the time it takes to download only that file, then Use the below steps after the step which downloads the file.
Note that the RecContentType=application/pdf for the step

 

web_url("BCAction.do",
        "URL={url}//BCAction.do?choice=display&ctno=1234567890",
        "Resource=1",
        "RecContentType=application/pdf",
        "Referer=",
        "Snapshot=t24.inf",
        LAST);

 time = web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);      
 lr_output_message("The time in ms to download CSS PDF is: %d",time);


Some more information about Web_get_int_property
The web_get_int_property function returns specific information about the previous HTTP request. 

The meaning of the return value depends on the HttpInfoType argument. HttpInfoType can be any of the following options. The first constant in each pair (HTTP_*) is for C, the second (object.HTTP_*) is for object oriented languages(Java scripts).


HTTP_INFO_RETURN_CODE or object.HTTP_INFO_RETURN_CODE
The return code in HTTP response header. 


HTTP_INFO_DOWNLOAD_SIZE or object.HTTP_INFO_DOWNLOAD_SIZE
The size (in bytes) of the last download, including the header, body, and communications overhead (for example, NTLM negotiation).


HTTP_INFO_DOWNLOAD_TIME or object.HTTP_INFO_DOWNLOAD_TIME
The time in (milliseconds) of the last download.


HTTP_INFO_TOTAL_REQUEST_STAT or object.HTTP_INFO_TOTAL_REQUEST_STAT
Returns the accumulated size of all headers and bodies since the first time web_get_int_property was issued with HTTP_INFO_TOTAL_REQUEST_STAT.


HTTP_INFO_TOTAL_RESPONSE_STAT or object.HTTP_INFO_TOTAL_RESPONSE_STAT
Returns the accumulated size, including header and body, of all responses since the first time web_get_int_property was issued with HTTP_INFO_TOTAL_RESPONSE_STAT

This function is supported for all Web scripts, and for WAP scripts running in HTTP mode only. It is not supported for WAP scripts running in Wireless Session Protocol (WSP) replay mode

9 comments:

  1. I am learning Qtp training in Chennai and now I am in intern, so I have referred a lot of blogs to enhance my skill test to get a good job ion testing industry, Thanks for the informative article.
    Regards,
    Qtp training Chennai|Qtp course in Chennai|Loadrunner Training in Chennai

    ReplyDelete

  2. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. 
    Loadrunner Training in Delhi

    ReplyDelete