LoadRunner function to measure size of downloaded file

This function can be used to measure the size of a downloaded file. It uses the LoadRunner lr_user_data_point function to save the downloaded file size into the results set. The size of these files can then be plotted as part of the results set or be displayed in the controller during a performance test.

Solution:
Use web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE); after the call to download the resource (this captures the size of the downloaded file).

iDLSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

Next report that to the scenario through a user point.

lr_user_data_point(“DownLoadSize”, iDLSize);

Here is a sample script:


vuser_init()
{
int iDLSize=0;

web_url(“index.php”, 
“URL=http://192.168.38.200/kb_portal/index.php?action=dlattach;topic=54.0;attach=21”, 
“TargetFrame=”, 
“Resource=1”, 
“RecContentType=application/octet-stream”, 
“Referer=”, 
“Snapshot=t1.inf”, 
LAST);

iDLSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

lr_user_data_point(“DownLoadSize”, iDLSize);

return 0;
}

Author: Richard Bishop

http://about.me/richard_bishop