How to validate file download scenarios in loadrunner?

Loadrunner
Scenario:

Lets say we have a script in which we need to do file download operation and we need to find out time taken for a file download and based on the file download operation we need to validate the transaction.

Solution:

web_get_int_property - This function provides specific information about the previous HTTP Request.

1. This can be done using web_get_int_property loadrunner function.
2. Place the web_get_int_property  function below the file download web_request.
3. Time taken to download the file can be obtained using HTTP_INFO_DOWNLOAD_TIME attribute of web_get_int_property.
4. Size of the downloaded file can be obtained using HTTP_INFO_DOWNLOAD_SIZE attribute of web_get_int_property.

Sample code below:

long fsize;
int ftime;

lr_start_transaction("File_Download");

web_url("File download HTTP Request");

ftime = web_get_int_property (HTTP_INFO_DOWNLOAD_TIME);

lr_output_message("File download time : %d", ftime);

fsize = web_get_int_property (HTTP_INFO_DOWNLOAD_SIZE);

if (fsize == 0)
{
lr_end_transaction("File_Download", LR_FAIL);
}
else
{
lr_end_transaction("File_Download", LR_PASS);
}




No comments:

Post a Comment