Академический Документы
Профессиональный Документы
Культура Документы
Introduction:
Library files:
Library file is nothing but a VB script file containing code in VB Script format. Library
files in QTP are used to declare functions that are needed to be used across
actions. There are two ways to load a Library file in to your test:
Create the VB Script file that you need and save to your PC
Go to the Resources tab of the Test Settings window and Click on “+” button. A
new line in the list box will appear
Click on “…” button to choose the location of the file
If you specify 2 or more library having a function with same name then QTP will
execute the one that comes first i.e. by looking at the order you specify the files.
There is no need to specify an order for dependent library file Ex- if file2 uses
functions defined in file1 then it is not necessary to specify file1 above file2 any
order will work fine.
Click on the “Check Syntax” button to verify that the script is a valid one
The VB script file has been associated with your test and functions it can be used
in all the actions present in the script. If you click on the “Set as Default” button
then all the library files specified in your current test would be automatically
added to the new tests that you create from now on.
Variables, classes, functions etc… declared in the Library files are accessible to all
the Actions present with in the test. Specifying library files using this method
makes it impossible to restrict the use of the Library to specific actions.
Instead of specifying the library file in test settings we can load it at run-time by
using the execute file function.
This would load all the variables, classes, structures etc… declared in the Library
but they would be accessible on in the action that has called the ExecuteFile
function i.e. if Action1 loads a library file using ExecuteFile then everything
present in the library file would only be accessible to Action1 and not any other
action.
To Load a library file present in Test Director the path can be specified
as
ExecuteFile “C:\File1.vbs”
Else
ExecuteFile “C:\File2.vbs”
End If
Reference:
1. “Mercury QuickTest Professional, User’s Guide, Version
8.0.1”
3.
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim lngPosition
End If
4.
Dim qtApp
Dim qtLibraries
Call test1()
Store the Library file along with the entire path in a variable.
OR
Just write ...........
Executfile ("D:/Files/Functions.vbs")
Below this call which ever function you want to call from the library file
Call FunctName(argument list)