Vugen Check file downloaded

Hi
I used vugen 9.52 and I'd like to check that when I click on a file link (on web page) a popup windows opens and I can save the file.
How can I check this (that the file really exists). I don't need to check file content.
Regards,
Marc

 

P.S. This thread has been moved from Performance Center Support and News Forum to LoadRunner Support Forum. -HP Forum Moderator

  • Verified Answer

    Perform a text check on part of the binary or output the file to the machine

    1. Text check with web_reg_find.
    For example, if you have a .pdf file, you can verify the information by using the regular text check function web_reg_find. Replay the script with extended log option "Data returned by server" to help to identify the piece of information to verify. If you decide to check on the text, the information could be in binary format, not as displayed in the Acrobat reader. If this is the case, then you can use the "/BIN" optioin to specify binary data.

    2. Check the size of the download.
    You can use the web_get_int_property() function with HTTP_INFO_DOWNLOAD_SIZE to check the size of the download is correct.

    Example:
    long i;

    //Start a transaction to download the file.
    lr_start_transaction("file_download");

    //HTTP call to the .pdf file
    web_url("");

    //Get the download size.
    i = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );

    //Check if the size if empty. If so, fail the transaction. You can set it to a specific number if you know the expected size.
    if ( i == 0 ){
    //End the transaction
    lr_end_transaction("file_download", LR_FAIL);
    }

    else{
    //End the transaction with passed status.
    lr_end_transaction("file_download", LR_PASS);
    }

    3. Output the data to a file.
    You can also output the data into a file (i.e., download the file, write it to the hard drive), then open it.

    Example: (This is for a .pdf file.)
    int fp;
    long i;

    //Truncate to zero length or create file for writing.
    fp = fopen("c://my_file.pdf","wb");

    //Start a transaction to time the download time.
    lr_start_transaction("file_download");

    //Set the parameter size large enough to save the data.
    web_set_max_html_param_len("100000");

    //Use web_reg_save_param with the correct boundary to capture the data returned by the server.
    web_reg_save_param("FILED","LB=","RB=","Search=Body",LAST);

    //HTTP call to the .pdf file
    web_url("");

    //Get the download size.
    i = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );

    //Write the data saved to an output file.
    fwrite(lr_eval_string("{FILED}"),i,1,fp);

    //End the transaction
    lr_end_transaction("file_download", LR_AUTO);

    //Close the file pointer.
    fclose(fp);
  • Hello there,

     

    Please  can you let me know a sample code for downloading an excel file.

  • This really helps.

     

    But can you please let me know How the downloaded file response time can be measured.

     

    I am trying to perform Sharepoint 2013 file download as part of load testing.... and unable to find a way to measure file download response time using HP Loadrunner 12.01 ??  Please let me know if any code helps...

     

     

    Thank you In advance.

    Best Regards,

  • Can you please let me know how we can do the same in TruClient protocol

  • In TruClient protocol you can use the isExist API to check repeatedly for a file on disk, and that's how you can know when it has downloaded

    IO.isExist(path[ string ]);