Re: Getting an error while trying to generate unique name and writing it as a pdf file.

304 views
Skip to first unread message

lucky2982

unread,
Sep 25, 2012, 12:16:22 AM9/25/12
to LR-Loa...@googlegroups.com
Hi SAM
 
Change the data and time format it will work, SPl character like semi colon (:) are not allowed and also (/)
 
keep the date and time format as %m%d%Y%H%M%S
 
Try now and let us know...!

On Monday, 24 September 2012 19:55:49 UTC+5:30, SAM wrote:

Hi,

I am new to Loadrunner and facing an error. Genius please help me out.

I am trying to generate a unique file name by invoking userid,iteration number and date/time as a parameter. Once this character is generated I am trying to use it to create a file name with .pdf extension. 

However,at the end of the iteration, I am getting error : Warning:Invalid parameter detected in function for step 9 i.e fclose(fp).

Please suggest as what could be corrective action. PFB code which is being used.

1.int fp;

2.int k;

3.unsigned long prmLen;

4. lr_save_string(lr_eval_string("{VuserId}_{Iteration}_{Date_Time}.pdf"),"k");

5. lr_output_message(lr_eval_string("filename is %s{k}"));

6. web_set_max_html_param_len("20000000");

7. fp=fopen(lr_eval_string("{k}"),"wb");

 //Write the data saved to an output file.

8.fwrite(data, prmLen, 1, fp);

 //Close the file pointer.

9.fclose(fp);

RESULT:

At the end of the iteration, I am getting error : Warning:Invalid parameter detected in function for step 9 i.e fclose(fp).


saunak suman

unread,
Sep 25, 2012, 2:41:19 AM9/25/12
to lr-loa...@googlegroups.com
Thanks lucky2982,
I was able to understand the problem. 
However, I can get upto the seconds limit. I mean in realistic scenario, we may have multiple file writing into the system within a matter of few mili seconds.
I was not able to reach to that depth using lr_save_datetime function.
Is there any other option which can help me to get to the miliseconds value?

Thanks
Sam

--
 
 

Pradhyumna Gupta

unread,
Sep 25, 2012, 3:57:09 AM9/25/12
to lr-loa...@googlegroups.com

Also point no. 6. Don't use that big of a value. You will end up eating lot of memory of you load generator

James Pulley

unread,
Sep 25, 2012, 9:57:08 AM9/25/12
to lr-loa...@googlegroups.com

You will turn your load generator into a bottleneck for your entire test.   You need to ask yourself why you are saving off PDF files when this will have a negative impact on your overall test design.   You note that you are new to LoadRunner, and presumably performance testing as well.  

 

Take a step back and look at your test design.    What is the requirement which is dictating your path to save files?   Your current path will result in a distressed load generator related to disk access from direct file saves and memory swaps as you exceed physical RAM.    Are you combining functional requirements with your performance test design?

 

You have a conceptual and code issue impacting the variable ‘k.’   You will have a response time issue when writing out the data during an open transaction.   Virtual User ID + <underscore>+time to the second+underscore+random two digit number  will provide distinctness.   However this is a path not recommended due to the negative impact on the execution of your performance test.

James Pulley

--
 
 

Kevyland

unread,
Sep 26, 2012, 10:00:44 AM9/26/12
to LR-Loa...@googlegroups.com
Like James I also question the validity of the download write test. 
What is the point of the test?
 
1) Are you more concerned that the request to download was honored under a load condition?
2) Are you just checking that during heavy downloads of PDF that their connection does not timeout?
 
Please clarify the performance test's purpose
 
Regards -
Reply all
Reply to author
Forward
0 new messages