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 ?
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
--> 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 ......