LoadRunner unique file name with web_save_timestamp_param function

LoadRunner unique file name with web_save_timestamp_param function

Earlier, I shown two ways how to create unique file names in LoadRunner:

Today I'm going to show the simplest way. And I would like to thank Charlie for his comment.
He suggested to use web_save_timestamp_param function.

web_save_timestamp_param function saves the current timestamp to LoadRunner parameter. Timestamp is the number of milliseconds since midnight January 1st, 1970 (also known as Unix Epoch).

This is how web_save_timestamp_param works:
web_save_timestamp_param("TimeStamp", LAST);
lr_output_message("Timestamp: %s", lr_eval_string("{TimeStamp}"));

And the result is:
Results in LoadRunner Generator
As I explained in this loadRunner tutorial about unique file names in LoadRunner, we have to get unique ids per virtual users with lr_whoami LoadRunner function.

So, the final LoadRunner script is:
char szFileName[256];
int vuserid, scid;
char *groupid;

lr_whoami(&vuserid, &groupid, &scid); web_save_timestamp_param("TimeStamp", LAST);

sprintf(szFileName, "%s_%d_%d_%s",



lr_output_message("File name: %s", szFileName);
And its result is from LoadRunner Controller:
Results in LoadRunner ControllerSo, you can add a required file extension (txt, pdf, etc) and get a unique file name. It will work for any number of concurrent virtual users in LoadRunner Controller.

  • Shown the way how to generate unique file names in LoadRunner
  • It uses web_save_timestamp_param function

Related articles:

Do you like this LoadRunner tutorial? Would you like to receive them in the future?
If yes, please subscribe to this blog RSS feed or by Email. (How to subscribe? VIDEO guide)

Do you know that you are free to use/copy/publish all my materials on your site/blog?


Anonymous said...

There is a web-based application which uses java applet for one of the pages. I am trying to record this application in LR9 using Web protocol. I tried using HTML and URL recording options. While replaying back my scripts, the page which uses java applet is not getting displayed but my script is not failing. Can anyone let me know which protocol I should use or should I include some code in my script to check for applet display

Dmitry Motevich said...

@ Anonymous,
You wrote:
"The page which uses java applet is not getting displayed".
How did you find out that java applets were not displayed?

I bet that you used Run-time Viewer.
In this case you should understand that Run-time Viewer is not actually real Browser. It has several limitations. For example, ActiveX controls, Java appletes, JavScript can work incorrectly. or they can not work at all.
It's explaned here.

So, you Run-time Viewer is not ideal way to check your LR Script. You should analyze LR's logs and logs from a tested application.

Anonymous said...

Hi Dmitry,

We have created a unique file name like 1222421760225_2_0_group1, but using the generated name how can we save the file into 1222421760225_2_0_group1.pdf...can you please give the code for that!!!

Dmitry Motevich said...

I created LoadRunner video PDF file recording and saving in LoadRunner

Machindra Jogdand said...

Hi Dmitry,

I always refer your blogs. I want to record a application using SAP NWBC client i.e. Netweaver Business client. It is starting with NWBCClient.exe file and inside that web based pages are displayed. But if i am recording using NWBC i cannot replay script its giving error that 'Browser not supported'.

Please can you explain how to do it?

thanks in advance.

Machindra Jogdand