RE: Regarding absolute path .

193 views
Skip to first unread message

venkates...@gmail.com

unread,
Feb 21, 2012, 10:34:07 PM2/21/12
to lr-loa...@googlegroups.com
Thanks for your response .
Even if we keep the document it script folder and when we move th script to other machine, path name will differ right ? Suppose in one system we keep script in C drive n in another system we keep in D drive . What we can do in this scenario ?

-original message-
Subject: Re: Regarding absolute path .
From: Taranjot Singh <cmil...@gmail.com>
Date: 21/02/2012 9:16 pm

Save ur file in ur load runner script folder

On 21 Feb 2012 21:09, <venkates...@gmail.com> wrote:

> Hi, i have script to upload the document and i want to place this script
> in multiple systems. Now the prob is document path , for every machine i
> need to define a relative path . Can anyone tell me that how to make
> absolute path in loadrunner , so that script will take care about the
> document path ,
> Thanks in advance .
>
> --
> You received this message because you are subscribed to the Google
> "LoadRunner" group.
> To post to this group, send email to LR-Loa...@googlegroups.com
> To unsubscribe from this group, send email to
> LR-LoadRunne...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/LR-LoadRunner?hl=en

--
You received this message because you are subscribed to the Google "LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en

Abhishek Banginwar

unread,
Feb 22, 2012, 6:22:24 AM2/22/12
to lr-loa...@googlegroups.com
if you hardcode the path. just use the file name.
Abhishek

Pradhyumna Gupta

unread,
Feb 22, 2012, 2:05:55 AM2/22/12
to lr-loa...@googlegroups.com
Why would you manually copy the scripts in different folders on different machines. All you need to do is have the scripts in the Controller machine. When you start the load test, your script is copied from the controller to all the mentioned Load generators.
 
So you wont run into any issues with the file path. Just make sure you are sending the file to the load generator machines in the controller settings.
 
-Pradhyumna

Taranjot Singh

unread,
Feb 22, 2012, 3:25:01 AM2/22/12
to lr-loa...@googlegroups.com
yes...u need to change the path in the script coding.


--
-----
*Taranjot Singh*

Avi's

unread,
Feb 22, 2012, 8:27:43 AM2/22/12
to lr-loa...@googlegroups.com
will this document changes.. you will have seperate document for each run..

If you are not changing the document for each run. Try attaching the
doc to the script.


--
Avinash N

André Luyer

unread,
Feb 22, 2012, 3:14:50 PM2/22/12
to LoadRunner
When a script is run on a load generator the current working directory
will be the script path. Note: the function getcwd returns the name of
the current working directory.
Don't bother to move files on the load generator, just add them to
your script. If necessary you can create a temporary file in the
current directory by code in your script.

If you use web_custom_request it is possible to upload a file that
does _not_ exist as a real file on the load generator. (The contents
may be a LR parameter.)

André

On Feb 22, 4:34 am, venkatesh.t.go...@gmail.com wrote:
> Thanks for your response .
> Even if we keep the document it script folder and when we move th script to other machine, path name will differ right ? Suppose in one system we keep script in C drive n in another system we keep in D drive . What we can do in this scenario ?
>
> -original message-
> Subject: Re: Regarding absolute path .
> From: Taranjot Singh <cmile...@gmail.com>
> Date: 21/02/2012 9:16 pm
>
> Save ur file in ur load runner script folder
>

Venkatesh T Gowda

unread,
Feb 23, 2012, 11:11:40 AM2/23/12
to lr-loa...@googlegroups.com
Hi Guys Thanks for your all valuable response ..

i used the below script to make it absolute path..

Filepath()

{


#define DIR_LEN 512

char original_dir[DIR_LEN];
char fullpath[1024], * filename = "DocumentToUpload.doc";


if (!getcwd(original_dir, DIR_LEN)) {

//lr_output_message ("getcwd error");

return -1;

}


if (chdir(original_dir)) {

// lr_output_message ("Cannot move back to %s", original_dir);

return -1;

}

else

// lr_output_message ("Moved back to %s", original_dir);


strcpy(fullpath, original_dir);

strcat(fullpath, "\\");

strcat(fullpath, filename);

// lr_output_message ("Full path of file is %s", fullpath);

lr_save_string(lr_eval_string(fullpath),"lrp_Filepath");


lr_output_message("Document Path is:%s",lr_eval_string("{lrp_Filepath}"));

}

--
With Regards,

Venkatesh.T.Gowda
 7760765757

André Luyer

unread,
Feb 23, 2012, 3:19:02 PM2/23/12
to LoadRunner
What I meant was that you should NOT use the full (absolute) path --
it is unnecessary.
And
- the use 'chdir(original_dir)' is superfluous.
- it still hurts my eyes when people uses strcat, use lr_param_sprintf
or the good old sprintf.

So you function should be:

Filepath()
{
lr_save_string("DocumentToUpload.doc", "lrp_Filepath");
...


Cheers,
André

On Feb 23, 5:11 pm, Venkatesh T Gowda <venkatesh.t.go...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages