tags:

views:

143

answers:

2

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 achieve this during the run time of every test?

+1  A: 

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"
Andrey
A: 

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"
katmoon
TestGeeK
I don't fully understand your first question. If you ask, how to change registry, follow the above istructions: create a .reg file, and run it from command line. As for setting env variables, there's a lot information in web.
katmoon
I want to set my System parameters. Like I want to Set JAVA_HOME, before executing every script. How can i achieve this using Script?
TestGeeK
QTP scripts are actually VBscripts. So you can use power of VBScripts to do what you want. E.g. see http://www.robvanderwoude.com/vbstech_data_environment.php
katmoon
Thank u .. this was more helpful for me.
TestGeeK