Load function libraries during a run session
Relevant for: GUI tests and components
If you decide not to associate a function library with a test, but do want to be able to call its functions or subroutines, you can do so by loading the function library during the run session. Similarly, if you want to call a function that is not stored in an action in your test or in an associated function library, store it in an independent VBScript file, and load that function library during the run session.
To load a function library during a run session, insert a LoadFunctionLibrary statement or ExecuteFile statement in your action, scripted component, or function library. When you run the test, this statement runs all global code in the specified function library, making all definitions in the file available for use..
The following table describes the differences between using each of these statements:
LoadFunctionLibrary |
ExecuteFile |
---|---|
In a test: After you run a LoadFunctionLibrary statement, the functions in the file are available to your entire test, until the end of the run session. In a component: LoadFunctionLibrary works in the same way as ExecuteFile. After you run the statement, the functions in the file are available only within the scope of the calling component. |
After you run an ExecuteFile statement, you can call the functions in the loaded file only within the scope of the calling action or component. |
LoadFunctionLibrary enables you to debug the functions in the function library during run-time. |
You cannot debug a file that is called using an ExecuteFile statement, or any of the functions contained in the file. In addition, when debugging a test or component that contains an ExecuteFile statement, the execution marker may not be correctly displayed. |
If you want functions in a function library (VBScript file) to always be available to your test or component, associate the function library with your test or application area.