QTP Functions

How we can return a value from a function in qtp

Questions by pvinilkumar

Showing Answers 1 - 12 of 12 Answers

hal9000

  • Dec 18th, 2007
 

Hi

To call a function, we need to prepare the function in the function library
for eg: This is the function you prepared in the library :
function mywebinvoke()
systemutil.run "iexplore",www.yahoo.com
end function

Now to call this function go to the test in qtp and type,

mywebinvoke()

it will directly go yahoo page.


  Was this answer useful?  Yes

anitamittal

  • Dec 20th, 2007
 

temp = ABC()
msgbox temp

Function ABC()
    ABC = "as"
End Function

You have to return the value using the function name as variable. Hope it helps!

Thanks,
Anita

  Was this answer useful?  Yes

Suppose if we write a function as follows:

Public function Sum (parameter1,.......)
a = 10
b = 10
c = a + b
msgbox c
Sum = c
End Function

Always one thing make sure that whatever the value you return, for ex, c, should point to the function name. In this case, Sum is the function name.

I think, this will work.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions