QTP: Set relative Path in QTP during the run time
using the menu bar of QTP, I can set my folder path and than use the relative path in the action scripts.
firstly, If i want to achieve the same with in a Script, how can i do this?
secondly, if i want to set the system environment variables named "TEST_ROOT_PATH", than how can i ac开发者_C百科hieve this during the run time of every test?
QTP allows dynamic modification of a collection of folders that act as a base for applying relative paths. You can access this collection by QTP Application's "Folders" method.
It should be something like this:
set qtApp = CreateObject("QuickTest.Application")
set qtFolders = qtApp.Folders
qtFolders.Add "Your path"
You can also set Folders from registry, because QTP saves its settings in registry.
Create a .reg file with such content:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\SearchPathFolders]
@=""
"path0"="<CurrentTest>"
"path1"="D:\\mylibrary"
and replace value of path1.
Executing from command line, use it with /s option (doesn't ask for confirmation):
regedit.exe /s "my.reg"
精彩评论