What are the advantages of Automation?
a. Repeatable:-If we have to run a set of tests repeatedly, automation is preferable.
It gives you the ability to run automation against code that frequently changes to catch
regressions in a timely manner It gives you the ability to run automation in mainstream
scenarios to catch regressions in a timely manner
Compatible: – Automated tests can be run on different machines with , whereas the
manual tests would have to be run sequentially.(different languages on different OS
Reusable:-Automated scripts can be reusable in different enrolments and different
applications on similar functionalities.
What are the recording modes in QTP?
QTP provides three types of recording methods to record operations:
Standard Recording (Normal) mode:-It is the default mode, which records all operations
Analog Recording Mode: –Records all operations of mouse and keyboard based on
Screen coordinates or application coordinates.
Low Level Recording: –We use low level recording to record the operations of mouse and
keyboard operations based on its coordinates
When do you use Low Level recording?
QuickTest pro. May not indentify all objects when quicktest fails to identify an object
during standard recording and to record operations where exact coordinates are required.
This mode records at the object level and records all run-time objects as Window or
WinObject test objects.
What the different checkpoints in QTP?
How do you check the availability of an object on the application during runtime?
Syntax: variable=object type (“object name”).exist
Ex: x=dialog (“Login”). Winedit (“Agent Name:”). exist
Note: It will return true if the object exists on the application, if not it returns false
How do you minimize a window or screen or page
Syntax: Object Type(“Object Name”).minimize
How do we get the count of items in a List or a Combobox?
Using Getitemscount method
Syntax: variable=Object type(“Object name”).getitemscount
Ex: Verifying no.of items, in “Fly From” Combo Box in Flight Reservation window
z = Window(“Flight Reservation”).WinComboBox(“Fly From:”).GetItemsCount
What are Test objects and run time objects?
Test objects are stored representations of the actual objects on an application. QuickTest
creates test objects by learning a set of the properties and values of the objects on an
Run-time objects are the objects that are available on Application Under Test.
How do you add objects to object repository?
We can add objects to object repository in two ways:
i) From Object Repository:
Navigation: Resources à Object Repository à Object à Add objects to local
ii) From Active Screens:
Navigation: Righ click on the object in active screens and select view/add object.
How do you convert the local objects as reusable objects?
By exporting the local objects from object repository and storing them in shared repository
file. Navigation: Resources à Object Repository à File à Export Local Objects
What is the file extension of shared Repository file?
tsr à Test shared repository
How do you associate shared object repository to an action?
Navigation: Edit à Action à Action Properties à Associate Repositories
How do you associate shared object repository for multiple actions in a test?
Navigation: Resources à Object Repository à Tools à associate Repositories
How many actions you can create in a test?
There can be any number of actions created in a single test.
What are the action properties and test properties?
Action properties are the properties for the current action only, where as test properties
belonging to total action properties in the current test.
What are the methods associated with actions in reusing the actions
1) Call to Copy of Action
2) Call to Existing Action
What is Option Explicit?
When used, makes mandatory to declare the variables in the script using a DIM
What is the syntax for the wait property?
Object type(“object name”).waitproperty “Property name”, “Property value”, “time in
What do you mean by call to copy of action and call to existing action?
(i) We can call both normal and reusable actions using call to copy an action and the called
action can be edited.
(ii) We can call only the reusable actions using call to existing actions and these are
considered as external actions, which are non editable.
How do you convert a normal action into reusable action?
Edit menuàActionàAction PropertiesàGeneralàReusable Action (Or)
In Test Pane Right clickàAction Propertiesà General à Reusable Action
How do you edit objects in shared object repository?
Select Object Repository Manager from Resources Menu Open the Shared repository file
Select Enable editing option then we can edit objects as per requirements.
What is debug viewer?
To view the variable values during execution of the script, change variable values during
What is step generator?
We can insert functions in the script from step generator, insert menu step step generator
select the category select the function specify the parameters
What is the extension of QTP Script file?
.mts(mercury test script)
What is the extension of Local object repository?
.mtr(mercury test repository)
What is the extension of shared object Repository?
.tsr(test shared repository)
What is the extension of library file?
When we creates & saves a library file it saves with the extension “.vbs(vbscript file)”
How do you return a value from a function?
By selecting call by return value in function definition generator in insert menu.
What is the syntax to define a function?
Public function function_name(parameters)
Can you write script to login; suppose browser name is b1, page name is p1, userid,
password, login button?
Few datatable methods
How do you import data from excel sheet to datatable?
A.Right Clickon DataTable Click on Sheet Import From file Browse the Path Or
Use Import method of datatable
Syntax: datatable.import “Path”
What is accessibility checkpoint?
An Accessibility checkpoint checks the Web page for Section 508 compliance.
How do you merge objects in 2 Repository files?
In Object Repository Manager Tools Object Repository Merge tool New MergeTool,
browse and select two Shared Repository filesand click OK
How do you associate library file to the test?
A library file can be associate in 2 ways:
i) Through File à Settings à Resources
ii) Execute file “File Path”
What is the use of User Defined Environment Variables?
These variables are made specific to test which are available to all the actions in that test
And also we can associate them to an external .XMl file so that they can be accessible
from any test.
How do you associate external environment variables file to the test?
File settings Environment User Defined Load variables and values from external file click
To access the variable in the script: Environment (“variable name”)
Where is the data stored when we write data to data table during runtime?
Runtime Table in Test Results
What is the use of Description class?
It is used to create an object by describing one or more properties of an object.
Syntax: set objectname=description.create
Can you write syntax to connect to database?
Set objectname=createobject (“ADODB.Connection”)
For MS Access:
Con.open “provider=Microsoft.jet.oledb.4.0; data source=database path”
For SQL Server:
Con.open “provide r= sqloledb.1; server=server name;uid=user name;pwd = password;
database = database name”
Con.open “driver = sqlserver; server = server name; uid = user name; pwd = password;
database = database name”
Which are the Databases supported by Quick Test Professional?
Oracle, MS Access, SQL Server, and Mysql
What type of license you have used for QTP in your project?
We use concurrent user license for 5 users at time
How do we retrieve data from an Excel File?
Import data from excel to datatable
Datatable.importsheet “pathofexcelfile”, sourcesheet, destinationsheet
In the script replace the value with the datatable parameter:
Datatable (“ParameterId”, “sheetId”)
What is Active Screen in QTP?
It is QTP tool feature in which it captures the snap shots of the application screens during
the recording process, we can use this screen to perform various script enhancements in
absence of application.
What are the different types of licenses in QTP?
There are 2 types of licenses in Quick Test:
i) Seat License: It is single user license, which can be installed in one work workstation.
ii) Concurrent License: It is otherwise called as Site License, it is multi pack, which comes
in bulk (4 or 5 or more license as a single pack)
Who provided license for QTP?
Hp- (Mercury Interactive)
What is difference between text and text area checkpoint?
Text checkpoint captures the complete text displayed on the object but text area
checkpoint captures the text in the specified specified area on an object
What are the different scripting languages QTP supports?
You can write your QTP automation programs in any Languages and development
Visual Basic, Visual C++, or Visual Studio.
What are the Technologies supportedby Quick Test?
Java, MS.Net, SAP, People Soft, Siebel, PoweBuilder, Flash ….Etc
How do you set permissions for executing the Quick Test scripts from Quality
In Quick Test; Goto Tools à Options à Run à selects other Mercury/Hp products to run
Tests and components
What is the syntax to open any windows based application from QTP?
Invoke application(“path of application”)
What is the extension of Recovery Scenario File?
When we create a recovery scenario and save in the system the scenario is created with file extension as “.qrs”(QuickTest recovery scenario)
What is difference between step into and step out?
During debugging the script we can use these options Step into will execute the script line
by line in main test & also in subtests where as Step over will execute line by line in the
main test and executes all the statements at single instance in called function or sub test.
What is the syntax for creating an object using VBScript in Quick Test?
Set Objetvariable=CreateObject (“server name”,”type name”)
Which Framework was implemented in your project?
Keyword driven framework, by implemnting User Defined Functions
What are the views under Test Pane in Quick Test?
QTP displays the test script in 2 views
Keyword view: The Keyword View enables you to create and view the steps of your
component in a keyword-driven, modular, table format. The Keyword View is comprised of
a table-like view, in which each step is a separate row in the table, and each column
represents different parts of the steps. You can modify the columns displayed to suit your
These statements are composed of objects, methods, and/or properties that instruct
QuickTest to perform operations or retrieve information
How do you configure an object as virtual object?
Using virtual object manager we can configure as follows:
Tools menuàVirtual Object ManageràClick on NewàSelect the Class Name to assignàpoint
the object using hand symbolàselect Object Name, Collection name to storeàselect Finish.
Can you write script to count the number of links in a web page?
Set objcoll=Browser(“Browser name”).page(“page name”).childobjects(Decobj)
In how many ways we can create test script in QTP?
We can create a test script in 3 ways:
i) Through recording.
ii) Through Step generator
iii) Through DP(Descriptive Programming)
What is objective of Dim?
It is used to declare multiple variables in a single statement as dimension, so that the
variable accepts of int, long, float etc.
What is Descriptive Programming?
Identifying the objects based on its properties in the script without storing the object
descriptions in object repository. We can use or implement this mechanism when the
repository is growing huge which might reduce the performance of Quick Test
We can achieve Descriptive Programming in two ways:
then enter the Description object name in the statement.
Ex: set br=description.create
What is the diff between language and scripting language?
In Language compilation and execution are of different process where as Scripting
Language Interpretation exists(no compilation and execution).
What is test object?
It’s an object that is stored in object repository with which Qucik Test uses to recognize an
object on the application. Each test object has one or more properties and methods that
can be used to perform operations on that object. Each object also has a number of
identification properties that can describe the object.
How to execute QTP from Command prompt?
From DOS prompt give the below command C:\\ qtpro.exe
What is difference between Internal and External environmental variables?
Scope of Internal environmental variables is limited to current test so that we can use in all
actions in the test where as external environmental variables are global, hence we can use
in any action of any test.
Write script to delete a file from file system?
Using file System Object “Delete Method” we can delete a file.
Ex: set fso=createobject(“scripting.filesystemobject”)
Explain advantages of Active screen?
We can perform the following operations using Active Screens:
i) Insert Standard, Text and Bitmap checkpoints
ii) Insert Standard Output value
iii) View and Add Object to object repository
In how many ways we can use checkpoints to an application using QTP?
In 3 ways we can use checkpoints to an application
i while recording the application
ii using the active screen we can add check points
iii while writing the scripts if we want to insert checkpoint there itself then we have to right.
What is checkpoint? Explain how it will work?
A checkpoint is a verification point that compares a current value for a specified property
with the expected value for that property. This enables you to identify whether your
application is functioning correctly.
Write the script to read values from Text file?
Set f=fso.opentextfile(“path of .txt file”,1)
Why you are Using Descriptive programming instead of Object Repository?
Descriptive Programming is an advanced concept in QTP.we can handle the Application by
implementing the DP instead of OR. Advantages of DP:
i DP Script is reusable Script
ii we can modify the script easily compare to QTP Code.
iii we can write script without application in hands based on the properties of objects.
iv DP is flexible for high performance of application compare to OR
v DP script is very flexible for meet the object implementation problem in application.
If there are two web objects with the same properties then how a specific object can
iii. Through Dynamic handling through Descriptive Programming.
Write script to work on excel sheets?
‘to get sheet count
‘to enter data
‘to add sheet
to delete sheet
to read the value
msgbox(var1&vblf&var2) to save worksheet
excelbook.saveas “path of location”
Explain Object Repository?
It is a common or central place where quick test will capture all the properties on an object,
which will make use of identifying the objects during runtime
How to load an object repository file in to QTP during runtime?
We can use RepositoriesCollection method ,
Syntax: RepositoriesCollection.Add(shared Object repository file path)
We can also associate this file with AOM concept
Set qtAppn = CreateObject(“QuickTest.Application”)
qtAppn.Visible = True
qtApp.Open “E:\Test\Test2”, False, False
Set qtObjRes = qtApp.Test.Actions
qtObjRes.Add “E:\OR\ObjRes.tsr”, 1
The above example Add the Object Repository (ObjRes.tsr) to the “Create” action