You are on page 1of 13

QTP interview questions and answers

1) Which environments are supported by QTP?

QTP supports the following environments
People &oft
Power 'uilder
Terminal (mulator
)isual 'asic
)isual Age
Web &ervices
To learn more about Add*ins and how to use them+ watch this video tutorial#
,) What are the types ob-ect .epositories in QTP#
QTP &upports , types of %b-ect .epository
1) &hared %b-ect .epository /also called 0lobal)
,) Per*Action %b-ect .epository+ /also called 1ocal)
Per*Action %b-ect .epository is used by default# The e2tension for Per*Action repository
is 3#mtr3 #
&hared %b-ect .epository is preferable while dealing with dynamic ob-ects which are
called in multiple tests# The e2tension is 3#tsr3
4) 5an we call QTP test from another test using scripting# &uppose there are 6 tests and 7
want to call these tests in a main script# 7s this possible in QTP?
8es# 8ou can call 6 or even more scripts in your tests#9or this+ first you will need to ma:e
the Actions in the corresponding scripts re*usable#Then from the destination script you
can ma:e calls to these re*usable actions#
6) What is action split and the purpose of using this in QTP?
Action split is to divide an e2isting action into two parts#The purpose is to divide actions
based on their functionality to improve code re*use#
;) <ow will you handle "ava tree in QTP ?
9oremost you will select "ava Add * 7n and launch QTP# $e2t step record operations on
the "ava Tree# 7f you face an issue while recording+ you can select Tools = %b-ect
7dentification = "ava+ tree ob-ect and ma:e changes in mandatory and assistive properties
to enable identification#
Tip> 8ou can base you answer on similar lines for any other ob-ect of any environment#
9or e2ample > 7f the question is how will chec: &AP chec:bo2 + 8ou say + first 7 will
select &AP Add in ### and so on#
?) (2plain how QTP identifies ob-ect ?
QTP identifies any 0@7 %b-ect based on its corresponding properties# While recording+
QTP will identify and store peculiar properties /as defined in the %b-ect 7dentification
settings) in the ob-ect repository of the 0@7 ob-ect # At run*time+ QTP will compare the
stored property values with the on*screen properties+ to uniquely identify the 0@7 ob-ect#
1earn more about %b-ect 7dentification
A) <ow many types of recording modes in QTP? Which will be used when ?
QTP supports 4 types of recording modes
1# $ormal mode also called 5onte2tual
,# 1ow*level recording mode
4#Analog mode
$ormal Bode> 7t is the default recording mode and ta:es full advantage of QTPCs Test
%b-ect Bodel# 7t recogniDes ob-ects regardless of their position on *screen# This is the
preferred mode of recoding and is used for most of the automation activities#
1ow*level recording mode> This mode records the e2act 2+y co*ordinates of your mouse
operations# 7t is helpful in testing hashmaps# 7t is useful for recording ob-ects not
identified by normal mode of QTP#
Analog mode> This mode records e2act mouse and :eyboard 3movements3 you perform
in relation to the screen E application window# This mode is useful for the operation such
as drawing a picture+ recording signature#+ drag and drop operations#
1earn more about .ecording Bodes in QTP
F) <ow will you call from one action to another action ?
We can call an action in , ways
1) 5all to copy of Action# * 7n this +the Action %b-ect .epository + &cript and !atable will
be copied to the destination Test &cript#
,) 5all to (2isting Action# * 7n this+ %b-ect .epository + &cript and !atable will $%T be
copied but a call /reference) would be made to the Action in the source script#
G) What are )irtual %b-ects?
8our application may contain ob-ects that behave li:e standard ob-ects but are not
recogniDed by QTP# 8ou can define these ob-ects as virtual ob-ects and map them to
standard classes+ such as a button or a chec: bo2# QTP emulates the userCs action on the
virtual ob-ect during the run session# 7n the test results+ the virtual ob-ect is displayed as
though it is a standard class ob-ect#
9or e2ample+ suppose you want to record a test on a Web page containing a bitmap that
the user clic:s# The bitmap contains several different hyperlin: areas+ and each area
opens a different destination page# When you record a test+ the Web site matches the
coordinates of the clic: on the bitmap and opens the destination page#
To enable QTP to clic: at the required coordinates during a run session+ you can define a
virtual ob-ect for an area of the bitmap+ which includes those coordinates+ and map it to
the button class# When you run a test+ QTP clic:s the bitmap in the area defined as a
virtual ob-ect so that the Web site opens the correct destination page#
1H) <ow to perform 5ross platform testing and 5ross browser testing using QTP? 5an u
e2plain giving some e2ample?
8ou will need to create separate Actions which ta:e care of different %& and 'rowsers
5ross Platform Testing>
@sing the 'uilt in (nvironment )ariable you can dig up the %& information#
(g# Platform I (nvironment/3%&3)# Then based on the Platform you need to call the
actions which you recorded on that particular platform#
5ross 'rowser Testing>
@sing this code (g# 'rowser/35ore )alues3)#0et.%Property/3version3) you can e2tract
the 'rowser and its correspondin version# (2> 7nternet (2plorer ? or $etscape ;# 'ased
on this value you call the actions which are relevant to that browser#
11) What is logical name of the ob-ect?
1ogical name is a name given by QTP while creating an ob-ect in the repository to
uniquely identify it from other ob-ects in the application# This name would be used by the
QTP to map the ob-ect name in script with its corresponding description in the ob-ect
repository# (2> 'rowser/3'rowser3)#Page/30uruGG3) <ere 0uruGG is the logical name of
the ob-ect#
1,) What is descriptive programming?
Typically +an ob-ect and its properties must be recorded in the %b-ect .epository to
enable QTP to perform action s on it#
@sing descriptive programming + you do not store the ob-ect and its property values in the
%b-ect repository but mention the property value pair directly in the script#
The idea behind descriptive programming is not bypass the ob-ect repository but help
recogoniDe dynamic ob-ects#
1earn more about !escriptive Programming
14)What are the properties you would use for identifying a browser J page when using
descriptive programming ?
8ou can use the name property
e2> 'rowser/3name>I322233)#page/3name>I3222233)#####
We can also use the property 3mic5lass3#
e2> 'rowser/3mic5lass>Ibrowser3)#page/3mic5lass>Ipage3)####
16)5an we record an application running on a remote machine using QTP ?
8es #you can record remote application provided you are accessing application through
the local browser not via remoter li:e citri2#
7f you are still unable to record it is advisable install QTP and application+ on the same
1;) (2plain the :eyword 5reate%b-ect with an e2ample#
5reates and returns a reference to an Automation ob-ect
&8$TA> 5reate%b-ect/servername#typename K+ locationL)
servername> .equired# The name of the application providing the ob-ect#
typename > .equired# The type or class of the ob-ect to create#
location > %ptional# The name of the networ: server where the ob-ect is to be created#
(2ample > &et 7( I 5reate%b-ect/37nternet(2plorer#Application3)
1?) 5an you switch between Per*Action and &hared %b-ect .epository ? 7f yes how ?
8es #We can switch# 0o to Test***=&ettings***=.esources# <ere you have an option to
choose repositories#
1A) What is %b-ect &py ? <ow to @se it ?
%b-ect &py helps in determining the run J test time ob-ect properties J methods of the
application under test#
8ou can access ob-ect spy directly from the toolbar or from the %b-ect .epository !ialog
7t is very useful during !escriptive Programming
1earn more about %b-ect &py
1F) When ordinal identifiers alone can ma:e an ob-ect unique then why they are not
given top priority? Why it is first mandatory and ne2t assistive# Why we cannot go for
ordinal identifiers directly?
5onsider the following *
a) 7f two ob-ects are overlapped on each other than location based ob-ect recognition will
b) 7f only inde2 based recognition is used your script will wor: but script e2ecution time
will increase#
<ence mandatory and assistive properties are used#
1G) What is the file e2tension of the code file in QTP?
5ode file e2tension is script#mts
,H) (2plain in brief about the QTP Automation %b-ect Bodel#
QTP Automation %b-ect model deals with Automation of QTP itself# Almost all
configuration and functionality provided by QTP is represented by QTPCs Automation
%b-ect Bodel # Almost all dialog bo2es in QTP have a corresponding automation ob-ect
which can set or retrieved using the corresponding properties or methods in the
Automation %b-ect Bodel#QTP Automation %b-ects can be used along with standard )'
programming elements li:e iterative loops or conditional statements to help you design a
script of choice#
,1) What is the use of Te2t output value in QTP?
Te2t %utput values enable you to capture te2t appearing on the application under test
during run*time#
7f parameteriDed+ te2t output values will capture values appearing in each iteration which
would be stored in the run*time data table for further analysis#
,,) What is &tep 0enerator?
&tep 0enerator enables use to Add Test &teps in your script# @sing step generator you can
add steps to your script without actually recording it#
,4) <ow to ma:e QTP understand the difference amongst the same type of ob-ects
#&uppose there are ; chec: bo2es in a page and 7 have to choose the ,nd one+ how to do
that through script?
8ou can use ordinal identifiers li:e inde2 along with a little descriptive programming for
ob-ect recognition#
Watch a video of this e2ample#
,6) What is Test 9usion .eport ?#
Test 9usion .eport + displays all aspects of a test run and is organiDed in a Tree format#
7t gives details of each step e2ecuted for all iterations#
7t also gives .un*time data table+ &creen shots and movie of the test run if opted#
,;) <ow can you handle e2ceptions in QTP?
7n QTP (2ceptional handling is done by using
a# .ecovery &cenarios#
b# @sing M%n (rrorN statement
7n .ecovery scenario you have to define#
1# Triggered (vents#
,# .ecovery steps#
4# Post .ecovery Test*.un#
At &cript 1evel you can use the %n (rror .esume $e2t and %n (rror 0o to H statement#
,?) What are the types of environment variables in QTP ?
(nvironment variables in QTP are of three types>
1) 'uilt*in /.ead only)
,) @ser*defined 7nternal /.ead only)
4) @ser*defined (2ternal /.eadEWrite)
8ou &et the (nvironment )ariable using the following synta2
(nvironment#)alue/ 3name3) I 30uruGG3
8ou can .etrieve the (nvironment )ariable using following synta2
(nvironment#)alue/3name3) ** This will retrun name as 0uruGG
(nvironment#)alue/3%&3) ** This will return your system %&
,A) What is the !ifference between 'itmap 5hec: point J 7mage 5hec: point?
'itmap chec:point does a pi2el to pi2el comparison of an image or part of an image#
7mage chec:point does do a pi2el to pi2el comparison but instead compare image
properties li:e alt te2t + destination url etc#
,F) What is the difference between functions and actions in QTP?
Actions have their own %b-ect .epository J !ata Table# Actions help ma:e your Test
modular and increase reuse# (2ample> 8ou can divide your script into Actions based on
functionality li:e 1ogin+ 1ogout etc#
9unctions is a )' &cript programming concept and do not have their own %b-ect
.epository or !ata Table# 9unctions help in re*use of your code# (2> 8ou can create a
9unction in your script to concatenate two strings#
,G) What is :eyword view and (2pert view in QTP?
Oeyword )iew is an icon based view which shows test steps in tabular format# 7t also
automatically generates documentation for the test steps#
(2pert )iew gives the corresponding )' &cript statement for every test step in the
Oeyword view#
4H) (2plain QTP Testing process? *
Quic: Test testing process consists of ? main phases>
1) 5reate your test plan * This is preparatory phase where you identify the e2act test
steps+ test data and e2pected results for you automated test# 8ou also identify the
environment and system configurations required to create and run your QTP Tests#
,) .ecording a session on your application * !uring this phase + you will e2ecute test
steps one by one on your A@T +and QTP will automatically record corresponding )'
script statements for each step performed#
4) (nhancing your test * 7n this stage you will insert chec:points + output values +
parameteriDation + programming logic li:e ifPelse loops to enhance the logic of your test
6) .eplay J !ebug * After enhancements you will replay the script to chec: whether its
wor:ing properly and debug if necessary#
;) .un your Tests * 7n this phase you will perform the actual e2ecution of your Test
?) AnalyDing the test results * %nce test run is complete+ you will analyDe the results in
the Test 9usion report generated#
A) .eporting defects * Any incidents identified needs to be reported# 7f you are using
Quality 5enter + defects can be automatically raised for failed tests in QTP#
41) What are the different types of Test Automation 9ramewor:s ?
The types of Automation 9ramewor:s are *
1) 1inear &cripting * .ecord J Playbac:
,) The Test 1ibrary Architecture 9ramewor:#
4)The !ata*!riven Testing 9ramewor:#
6)The Oeyword*!riven or Table*!riven Testing 9ramewor:#
1earn more about Test Automation 9ramewor:s#
4,) <ow will you chec: a web application for bro:en lin:s using QTP?
8ou can use the Page 5hec:point which gives a count of validEinvalid lin:s on a page#
44) What is a .un*Time !ata Table? Where can 7 find and view this table?
!ata li:e parameteriDed output + chec:point values + output values are stored in the .un*
time Table# 7t is an 2ls file which is stored in the Test .esults 9older# 7t can also be
accessed in the Test 9usion .eport#
46) What is the difference between chec: point and output value#
5hec: point is a verification point that compares a current value for a specified property
with the e2pected value for that property# 'ased on this comparison+ it will generate a
PA&& or 9A71 status#
An output value is a value captured during the test run and can be stored in a specified
location li:e the !atable or even a variable# @nli:e 5hec:points+ no PA&&E9A71 status is
4;) <ow would you connect to database using vbscript ?
To connect to the database you must :now
a) connection string of your server
b) username
c) password
d) !$& name
8ou can code the database connectivity command directly or you can use the &Q1 Query
tool provided by QTP#
4?) What is QTP batch testing tool?
8ou can use the 'atch testing tool to run multiple scripts# %nce the scripts are added in
the tool + it will automatically open the scripts and start e2ecuting them one after the
4A) What are the drawbac:s of QTP?
As of QTP version 1H
1) <uge Tests in QTP consume lots of memory and increase 5P@ utiliDation#
,) &ince QTP stores results in <TB1 file /and not t2t) the result folder sometimes
becomes big#
4F) What is an %ptional &tep ?
A step when declared optional is not mandatory to be e2ecuted# 7f the corresponding 0@7
ob-ect is present+ QTP performs the operation on it# 7f the 0@7 ob-ect is not present+ QTP
bypasses the optional step and proceeds to e2ecute the ne2t step#
4G) What is .eporter#.eport(vent ?
.eporter#.eportvent is standard method provided by QTP to send custom messages to the
test results window#
.eporter#.eport(vent (vent&tatus+ .eport&tep$ame+ !etails K+ 7mage9ilePathL
(vent&tatus I H or micPass
1 or mic9ail
, or mic!one
4 or micWarning
.esults can assume any status li:e Pass + 9ail + Warning etc# 8ou can also send
screenshot to the test results window#
6H) <ow will you declare a variable in QTP ?
8ou declare using a !7B :eyword# 8ou assign value to the variable using the &(T
!im temp CWill declare the temp variable
&et temp I ,H C Will assign a value ,H to temp#
61) What is 0et.oProperty ?
0et.oProperty is a standard method provided by QTP to fetch property values of a run
*time ob-ect#
6,) What is smart 7dentification?
Typically+ if even one of the on*screen ob-ect property does not match the recorded ob-ect
property# The test fails#
7n smart identification+ QTP does not give an error if the property values do not match+
but uses 'ase filter and %ptional 9ilter properties to uniquely identify an ob-ect# 7n &mart
identification+ if a property value does not match the script does not fail but it proceeds
ahead to compare the ne2t property# &mart identification can be enabled in %b-ect
7dentification !ialog bo2#
1earn more about &BA.T 7dentification
64) <ow would you e2port a &cript from one P5 to another in QTP ?
We can ma:e use of the 30enerate &cript3 function available in %b-ect 7dentification+ Test
&ettings and ToolsE%ptions tab to create a Dip of the script at the source computer# These
Dip files then can be imported into QTP at the destination computer#
66) 5an launch two instances of QTP on the same machine ?
$o# 8ou can wor: with only single instance of QTP on the same machine# 'ut QTP itself
can wor: on multiple instances of the Application @nder Test /A@T)# (2> QTP can
handle multiple 7( browser windows#
6;) 0ive the synta2 to importEe2port 2ls into QTP#
!ataTable#7mport&heet 3##Q##QTest!ataQ7nput#2ls3+1+dt0lobal&heet
!ataTable#(2port&heet 3##Q##Q.esultsQ%utput#2ls3+30lobal3
6?) What is &etToProperty ?
&etToProperty changes property of an ob-ect stored in the %b-ect .epository# <owever
these changes are not permanent#
6A) What is the standard timing delay for web based application in QTP ?
The standard delay is ?H seconds# This is can be changed in Test &ettigns#
6F) What is the Action 5onversion Tool ?
7t is an in*built tool provided by QTP to convert Actions into 'usiness Process
6G) What is the e2tension for a function library ?
The e2tension is C#Q91C
;H) 7f the 0lobal !ata sheet contains no data and the 1ocal !atasheet contains two rows
of data+ how many times will the test iterate?
The test will iterate only once * global iteration#