Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can WinRunner read Environment variables?

Status
Not open for further replies.

richardchaven

Programmer
Jan 13, 2003
161
0
0
US
I want to allow scripts to run on different machines and hide the local configuration in environment variables (actually, the variables are already set and I want to make use of them).

How can a WinRunner script get the text of an environment variable?

Cheers
 
Code:
getenv ( environment_variable );

It's easy, once you already know it. Of course, it would have been easier if the index actually had synonyms!



Cheers
 
AHHHH!!!!!!

It's WinRunner's "environment", not Windows.

Sigh

Cheers
 
Hi,
hope this will help you! I am using it and it work No mater where you want to run yourscirpt!


public function setpath (out PATH, inout Work_dir )
{
auto PATH_1,PATH_2,PATH_3;
auto i,slash,Work_path,iPath,path_array[] ;
PATH = "";
slash = "";
Work_path ="";
iPath = split (Work_dir, path_array, "\\");
for (i=1; i <= iPath; i++)
{
Work_path = Work_path & slash & path_array ;
slash = "\\";
Work_dir = Work_path ;
}
PATH_1 ="<C:\Program Files\Mercury Interactive\WinRunner\samples\bookexmp\lib><.><C:\Program Files\Mercury Interactive\WinRunner\lib>";
PATH_2 = "<" & Work_dir & "\Directory1>";
PATH_3 = "<" & Work_dir & "\Directory2>";
PATH = PATH_1 & PATH_2 & PATH_3;
}

setpath(PATH,Work_dir);
setvar ("searchpath",PATH);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top