Highlighted
Absent Member.
Absent Member.
1823 views

Can we measure .PDF file down load time?

Jump to solution
In our application, when user clicks Report link, .PDF file will display/generate in next webpage,
Is it possible to measure howmuch time it takes to display .pdf file.

When I ran a script .pdf file is not displaying/generating.

Thanks
Ravi Allam
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Do you have a web_link when u click the link to download the PDF file
when u replay the script do u see this web_link("PDF") was successful in the replay log.
in the web_link where u click to download the pdf you will see a snapshot=t1.inf or something like this
once the replay is completed go to the result folder-iteration1 and open the t1.inf
there u can see the filename of the pdf that got downloaded which will be there in the result folder
if u open that pdf that is what pdf that you are trying to open with your script.
this is the way you can confirm that your script has downloaded the pdf file and if your pdf file is there then it means you have downloaded it successfully.
capture the time for that web_link which is your pdf download time

View solution in original post

7 Replies
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
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);
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Hi,

I am attaching screen shot
when user clicks Report button,
web page appear (see page 1 ) gives message 'report running' it takes not less than 120 sec,
then pdf file will generate (see page 2), it has few links to save, to return to previous etc.

When I play back script download time dispalying hardly 5 sec. (See below code)

y = web_get_int_property( HTTP_INFO_DOWNLOAD_TIME );
lr_output_message("PDF download time: %.2f milliseconds", y );

PDF download time: 4995.00 milliseconds


Not sure why VUGen not waiting it complete to generate,
Any solution to get reasonable download time of pdf file?

Thanks
Ravi Allam
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Do you have a web_link when u click the link to download the PDF file
when u replay the script do u see this web_link("PDF") was successful in the replay log.
in the web_link where u click to download the pdf you will see a snapshot=t1.inf or something like this
once the replay is completed go to the result folder-iteration1 and open the t1.inf
there u can see the filename of the pdf that got downloaded which will be there in the result folder
if u open that pdf that is what pdf that you are trying to open with your script.
this is the way you can confirm that your script has downloaded the pdf file and if your pdf file is there then it means you have downloaded it successfully.
capture the time for that web_link which is your pdf download time

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Hi,

I can give you only 10 points, nice answer.
Yes pdf file is available in Iteration1 folder, when I ran 2 iterations that pdf file also
available in Iteration2 folder also.

Not sure where from this pdf file is coming,
as I said in my previous response, when we do it manually this pdf file getting generated after 2 min.
that is why I am wondering how this file is generated so quickly when we run script.
Is it really generating/downloading or is picking from the cache?

Also transaction response time for this web_url() is around 5 sec. so concern team will not accept if I say
time taken to download pdf file is 5 sec, because they are experiencing very slow (more than 100 sec).

My basic question is 'why the response time has so much difference with actual value?

Thanks
Ravi Allam
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Try this code

long DSize=0;

float DTime=0;

DSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

lr_output_message(â DSize is: %.2ld Bytesâ , DSize);

lr_output_message(â File Download size is: %.2ld KBâ , DSize /1024);

DTime = web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);

lr_output_message(â File Download Time is:%.2f Secondsâ , DTime / 1000);
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
code attached
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can we measure .PDF file down load time?

Jump to solution
Hi,

yes I used this method/funtion in my script,
it showing 5 sec for download time, but when we do it manually it takes more than 100 sec.Not sure why there is so much difference.

Thanks
Ravi Allam
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.