ExecuteFile Method vs LoadFunctionLibrary Method
Using
ExecuteFile Method
ExecuteFile statement
executes all the VBScript statements in a specified file. After the file has
been executed, all the functions, subroutines and other elements from the file
(function library) are available to the action as global entities. Simply put,
once the file is executed, its functions can be used by the action. You can use
the below mentioned logic to use ExecuteFile method to associate function
libraries to your script.
‘Action begins
ExecuteFile
"C:\YourFunctionLibrary.vbs"
'Other logic for your
action would come here
'.....
Using LoadFunctionLibrary Method
LoadFunctionLibrary, a new
method introduced in QTP 11 allows you to load a function library when a step
runs. You can load multiple function libraries from a single line by using a
comma delimiter.
'Some code from the action
'.....
LoadFunctionLibrary
"C:\YourFunctionLibrary_1.vbs" 'Associate a single function library
LoadFunctionLibrary
"C:\FuncLib_1.vbs", "C:\FuncLib_2.vbs","C:\FuncLib_1.vbs",
"C:\FuncLib_3.vbs","C:\FuncLib_4.vbs",
"C:\FuncLib_5.vbs" 'Associate
more than 1 function libraries
Comments
Post a Comment