Highlighted
Absent Member.
Absent Member.
9731 views

VU Gen didnot record the PDF file download

I am using LR 9.51 and Using http (URL mode) (protocol). In my application when I select one statement (Lets say statement for a month for utility). it redirects to window with new url which is PDF file. VU gen didnot record this event. I tried to validate the download time and download size. I see zero. I used to text checkpoint for text content in PDF file. Checkpoint fails. I used web_custom_request for that New URL and try to validate the download size, time and text checkpoint it didnot work.

Can you provide me some idea to resolve this issue.

Tags (1)
0 Likes
9 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: VU Gen didnot record the PDF file download

Saving the file to a local machine by opening "save as dialog", is a client side activity, which we cannot record it in Vugen. We can record till the pdf download request sent to the server and the response content you can see it in generation log. As you mentioned it is a pdf document, it should be in encryted form and cannot put the text check on the contents of the file. But you can measure the response time of the download by wrapping the pdf request step in transactions. And you may save the file to local machine which was downloaded during reply using some customized code. there is a hp knowledge base article to achieve this.

Tags (1)
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: VU Gen didn't record the PDF file download

HI,

 

From what I understand, VUGen did not record the PDF download. So even if you validate the download time and size it would show a value of 0 only. I would suggest that you find the URL to the PDF manually (if it has any dynamic ID's, take care of it in the script) and add it to your script and do the download validation. This should work.

Highlighted
Contributor.
Contributor.

Re: VU Gen didn't record the PDF file download

Hi,

 

You can download pdf to your computer and also calculate time taken to download the pdf and the size of the pdf.

You just use one pre-defined function web_get_int_property. Just see the help in function reference and you will know how to calculate time taken for downloading and size of the pdf.For saving it at a pre-defined place you have to write a small code.

Please let me know is this solve your problem or not.

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: VU Gen didnot record the PDF file download

Is it necessary to record/regenrate Vugen script in URL mode if we want to achieve this

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: VU Gen didnot record the PDF file download

long Download_Size=0;

float Download_Time=0;

Download_Size= web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

Download_Time= web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);


lr_output_message("Downloaded File Size is: %.2ld Bytes", Download_Size);

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

lr_output_message("File Download Time is:%.2f Seconds",Download_Time / 1000);

Regards,
Gagandeep Malviya

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution
0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: VU Gen didnot record the PDF file download

Also forgot to mention, write this code after you click on save button or web_submit().


eg:

web_submit(){
...
...
}

lr_start_transaction("File_Download_Scenario");

Download_Size= web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

Download_Time= web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);


lr_output_message("Downloaded File Size is: %.2ld Bytes", Download_Size);

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

lr_output_message("File Download Time is:%.2f Seconds",Download_Time / 1000);

lr_end_transaction ("File_Download_Scenario", LR_AUTO);
Regards,
Gagandeep Malviya

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: VU Gen didnot record the PDF file download

The complete code for downloading file to the local disk,  calculate the downloand size and response time.
 

long fp,Download_Size=0;

float Download_Time=0;
char *data;
unsigned long prmLen;

long Download_Size=0;

 

 

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

 

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

 

//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);

 

web_url("PDF",
..............................

.............................

.............................

 

LAST);

 

Download_Size= web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
Download_Time= web_get_int_property(HTTP_INFO_DOWNLOAD_TIME);

 

//Get the download size.
lr_eval_string_ext("{FILED}", strlen("{FILED}"), &data, &prmLen, 0, 0, -1);

 

//Write the data saved to an output file.

fwrite(data, prmLen, 1, fp);

 

//Close the file pointer.
fclose(fp);

 

lr_output_message("Downloaded File Size is: %.2ld Bytes", Download_Size);
lr_output_message("File Download size is: %.2ld KB", Download_Size /1024);
lr_output_message("File Download Time is:%.2f Seconds",Download_Time / 1000);

 


Thanks,

Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: VU Gen didnot record the PDF file download

Thanks Ajay!
However, if you look at the contents of pdf downloaded this way (through script) versus what gets downloaded manually, - there is a huge difference. Basically it just loads the text, not the formatted text and tables and numbers present in the original pdf file. Is there a way to retain exactly the same format in script downloaded pdf as manually downloaded pdf?

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: VU Gen didnot record the PDF file download

Hi Ranvijay,

You cant retain the PDF back using LR script. 

Although you need not worry about the content because LR captures the same content with the same size which fulfils the performance testing purpose.  

Regards,
Gagandeep Malviya

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution
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.