标题: WinRunner:Modifying searchpath for the current test. [打印本页] 作者: pcl2004_27 时间: 2006-10-25 13:47 标题: WinRunner:Modifying searchpath for the current test. Description
This technique allows each test to modify the searchpath as needed without adding duplicates and leaving unnecessary directories in it.
Solution
#Get the current path and the test path.
orgPath = getvar("searchpath");
testPath = getvar("curr_dir");
#if the test path is not in the current path
if ( index(orgPath,testPath) == 0 )
{
#add the test path to the current path.
newPath = orgPath & "<" & testPath & ">";
setvar("searchpath",newPath);
}
#Tests go here.
#Restore the old path.
if ( orgPath != "" )
{
setvar("searchpath",orgPath);
}