In order to modularize the script, library Files are added to the QTP Script. It contains variable declaration, Functions, Classes etc. They enable reusability that can be shared across test scripts. They are saved with an extenstion .vbs or .qfl
How to Associating Function Libraries
Method#1 : "File" > "Settings" > Resources > Associate Function Library option. Click on "+"
Method#2 : Using ExecuteFile method.
for eg ExecuteFile "C:\lib1.vbs"
Method#3 : Using LoadFunctionLibrary Method.
for eg LoadFunctionLibrary "C:\lib1.vbs"
Method#4 : Using AOM
Automation Object Model(AOM), a mechanism using which we can control various QTP operations outside QTP.
Using AOM
- We can launch QTP
- Open the Test,
- Associate Function Libraries etc.
Set objQTP = CreateObject("QuickTest.Application") 'Launch QTP
objQTP.Launch
objQTP.Visible = True
objQTP.Open "D:\GUITest2", False, False 'Open the test
Set objLib = objQTP.Test.Settings.Resources.Libraries
'Associate Function Library if NOT associated already.
If objLib.Find("C:\lib1.vbs") = -1 Then
objLib.Add "C:\lib1.vbs", 1
End
No comments:
Post a Comment