Reading:  

Quick Test Professional - The starters Guide


Using Library files in QTP

A library is a file which contains variable declaration, classes, function and sub procedures. These library files can be associated to any code in QTP, it is helpful for the code in QTP can call or reuse the procedures present in the library file.

Library files can have the following extensions:

  • .txt
  • .vbs
  • .qfl 

To create Library File: Go to "File" select "Function Library". 

Libraries Associating Functions are:

Method 1: Navigating to "File" click on "Settings" select ” Resources”  select ” Associate Function Library” option. Press "+" icon to add Function Library File and add it by using actual path as shown:

Resources QTP

 

Method 2:

We can also add by using ExecuteFile method as shown in below example:

Syntax ExecuteFile(Filepath)
 ExecuteFile "C:\library1.vbs" 
 ExecuteFile "C:\library2.vbs" 
 

Method 3:

We can also add using LoadFunctionLibrary Method as shown in below example:

Syntax:LoadFunctionLibrary(Filepath)
  LoadFunctionLibrary "C:\library1.vbs" 
  LoadFunctionLibrary "C:\library2.vbs" 

 

Method 4:

Automation Object Model (AOM): It is mainly used to launch QTP, Associate Function Libraries, Open the Test, etc.

The below Vbscript should be saved with .vbs Extension and upon executing it, QTP will be launched and test will be start executing

'To Launch QTP
 Set objQTP = CreateObject("QuickTest.Application")
 objQTP.Launch
 objQTP.Visible = True
  
 'To Open Specific test
 objQTP.Open "D:\GUITest2", False, False
 Set objLib = objQTP.Test.Settings.Resources.Libraries
  
 'Associate Function Library if not associated already.
 If objLib.Find("C:\library1.vbs") = -1 Then 
   objLib.Add "C:\library1.vbs", 1 
 End
 

 

Description

In this tutorial, we will get to know Quick test professional. At the time of writting QTP is at version 12.2. This tutorial is subdivided into multiple parts as shown below

  • What is QTP
  • Automating tests
  • Environment
  • Recording and Playback
  • Object Repository
  • Actions
  • Data Table
  • Checkpoints in QTP
  • Synchronization
  • Smart Identification
  • Debugging and Error handling
  • Recovery Scenarios
  • Environment Variables
  • Library Files
  • Test Results
  • GUI Objects
  • Virtual Objects
  • Accessing Databases
  • Working with XML
  • Descriptive Programming
  • Automation Object Model
  • A work on Frameworks

Leave your feedback for us, Feedback help us improve our tutorials.

 



Prerequisites

Some knowledge on Windows OS and VB Script is recommended

Audience

Students who wish to learn QTP

Learning Objectives

Learn QTP

Author: Subject Coach
Added on: 16th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!