Posts: 24
Threads: 10
Joined: Aug 2009
Reputation:
0
08-25-2009, 06:39 PM
Hi,
We are trying to migrate a project from WinRunner to QTP..
Could any one suggest the Equivalent QTP funtions for the below mentioned WR functions:
1. getvar
2. return
3. match
4. treturn
Posts: 1,199
Threads: 5
Joined: Nov 2008
Reputation:
0
08-25-2009, 07:01 PM
can you please explain breifly about what each function do, may be I can help you.
Posts: 24
Threads: 10
Joined: Aug 2009
Reputation:
0
08-25-2009, 07:31 PM
1. getvar - getvar Returns the value of a testing option/configuration parameter.
Examples: 1. old_t = getvar ("timeout"); 2. old_d = getvar ("delay");
2. return - returns an expression to the calling function or test. It also halts execution of the called function and passes control back to the calling function or test. If no expression is used, then an empty string is returned.
3. match - finds the occurrence of a regular expression in a string. This function returns the location in the string at which the regular_expression is found. The value returned is the character position at which the regular expression starts.
4. treturn - The treturn statement is used when calling a test. It stops a called test and returns control to the calling test. It also provides a return value for the called test.
5. getenv - returns the value of any environment variable, as defined WinRunner runtime environment.
getenv function reads the current value of an environment variable.
Posts: 1,003
Threads: 1
Joined: Jul 2009
Reputation:
5
08-26-2009, 06:20 PM
Answers to whatever i can help you with,
3. match - finds the occurrence of a regular expression in a string. This function returns the location in the string at which the regular_expression is found. The value returned is the character position at which the regular expression starts.
Instr is the function you must be looking for. Research about Instr on any vbscript help and you will know about it.
4. treturn - The treturn statement is used when calling a test. It stops a called test and returns control to the calling test. It also provides a return value for the called test.
Could be compared with Actions. You can call actions as a copy of action or existing action. The values are sent or retrieved through Input & Output Parameters.
5. getenv - returns the value of any environment variable, as defined WinRunner runtime environment.
getenv function reads the current value of an environment variable.
I am not a expert on Winrunner. But from what you say i guess you are reffering to Environment.Value("env_var_name"). The usage is dynamic as well static. Try this on QTP and you will know what i mean,
Code:
oTestName = Environment.Value("TestName")
msgbox oTestName ' Will tell you the current test name.
There are 2 types of Environment Variables. Inbuilt and UserDefined. The above code will fetch data from a Inbuilt Environment variable.
Please do spend sometime with the QTP help trying to understand the above explanation.
if you have questions please post back.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.