How to recall a function in QTP

Showing Answers 1 - 18 of 18 Answers

Wasim

  • Nov 9th, 2005
 

Sorry i didnt get the meaning of recall, do u want to call a function in the script?

  Was this answer useful?  Yes

kumar

  • Nov 9th, 2005
 

Dear Wasim.... Assume that U are calling a funtion in QTP Script, & if u want to recall that same fuction in some other part of the same script..... What would u do ?

  Was this answer useful?  Yes

Wasim

  • Nov 10th, 2005
 

There also u follow the same procedure. See the sample code

Function addition(x,y)
   z= x+y
   msgbox z
End Function

Call addition(1,2)
Call addition(2,2)

I think i am clear :)

  Was this answer useful?  Yes

Wasim

  • Nov 10th, 2005
 

There also u follow the same procedure. See the sample code

Function addition(x,y)
   z= x+y
   msgbox z
End Function

Call addition(1,2)
Call addition(2,2)

I think i am clear :)

  Was this answer useful?  Yes

Manju

  • Mar 28th, 2007
 

Hi,1) we can Recall any function from any place of the script usingcall function-name(//with parameters)2) if you Reuse the same function then the last function will be called, below is sample codeCall add(1,2)Function add(a,b) MsgBox "This will not work "&eval(a+b)End FunctionCall add(1,2)Function add(c,d) MsgBox "This will work "&eval(c*d)End Function

RamuGoud@919866178926

  • Apr 14th, 2007
 

Hai Kumar, I think we save the file with .vbs extension in external file and associate that library to the QTP, and we call that function in any test

Associate the library in this way

Test-->Settings-->Resources-->Add the external saved library

  Was this answer useful?  Yes

sreekanth chilam

  • May 1st, 2007
 

Actually, there will be 3 types functions :

--> Local script (Function definition and function call will be in script only )
-->
Built functions (Predefined functions , only we have to call these functions)
--> Library functions (these are functions defined in .vbs file (library file here Function calling will be done in script but not Function
definition )

you just define all required functions in one library file (store it one location)

Then load the library file into QTP environment by Test menu
--> settings --> Resources->
there click "+" and browse and load the
required library and click "apply",

Then you can call the function
anytime contained in above library file ......


  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