How to create and validate a pdf download script in LoadRunner

How to create and validate a pdf download script in LoadRunner

Saving a file to the local machine during recording of a pdf download script in loadrunner VUgen, by clicking on”save as” button, is a client side activity and does not get recorded. But the action on web page which results the file download box gets recorded in VUgen and actually downloads the file (pdf file/Zip file).

The downloaded file can be found in the data folder of recorded script by checking the size/type of contents.

To verify if the script is downloading file during run-time, check the iteration# folders (inside result1 folder) for the file.

If you know the size of file (in Kbs) which you are downloading, you can also use below code to check if the file has got downloaded successfully or not.

web_url (Request for file download)

DownloadSize = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE ); //define DownloadSize  as an integer variable at the beginning of action code

lr_output_message(“Downloaded File size is %d” , DownloadSize);

if (DownloadSize < 1000) {  //The file to be downloaded has size of 1000 kbs

lr_error_message(“File download has failed and downloaded content size in KBs is %d”, DownloadSize);

}

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.