QTP Interview Questions and Answers with Some Useful Interview Tips

Below are some useful tips to prepare for QTP interview, followed by the most common QTP interview questions and answers. Actually we had planned this post at the end of our QTP training article series. But many readers requested to provide interview questions so that you can prepare for interview while learning QTP.

Note – In this post we have covered some useful tips to prepare for QTP interview along with top 20 common and crucial Quick Test Professional questions and answers. Please provide more questions in comments and we’ll update this post with answers to your questions. You can also post your questions using this “Share Your QTP Interview Questions” page.

We devised a list of pre-requisites or non-technical aspects that every QTP interviewee has to be familiar with.

Here are some useful tips to prepare for QTP interview:

QTP Questions

  • QTP is merely a tool that facilitates testing. The ultimate goal of QTP- or any other testing tool for that matter- is efficient and effective testing. So, make sure your testing fundamentals are solid.
  • Next undeniably is the knowledge about the QTP tool. Make sure you know all the basic information about the tool.
  • QTP predominantly relies on a tester’s programming skills to design, develop and maintain tests. That does not mean knowing all the features of the tool or VB Script are enough. The most important skill the automation tester should have is the ability for logic building. QTP tool and VB Script are simply vehicles that help you reach a solution.
  • In the recent days most interviewers are asking questions that either involve writing a script on paper or coding on a QTP installed machine. If you can code on a machine or write the code spontaneously, that’s great! If not, I suggest you to write the solution to the problem given to you in simple English statements. This will give a chance to show case your solution forming ability. Explain that to translate this solution into a program is simply a matter of referring to the help files of the programming language to find the equivalent statements.
  • In an interview, when you are writing code, please do not forget to include comments. Showcase good programming practices.
  • Before attending a QTP interview, be sure to know the version of the QTP, the add-ins that you use, the versions of all the other software you are using etc.
  • If you have not been using QTP recently but have had past experience, it helps to take a couple of hours to re-familiarize with the IDE.

The most common but crucial questions that are asked in the QTP interview. The best part of these questions is that you have time to prepare an answer in advance before even the interview begins.

  1. What are the reasons for choosing to automate your project and why did you choose QTP?
  2. What is the most challenging testing situation you faced and how did you overcome it?
  3. Did QTP prove efficient for your project? Yes or No, explain?
  4. How did you achieve reusability via QTP?
  5. Did you find anything in your project that QTP proved inefficient to perform?
  6. Under what conditions would you recommend QTP for future projects?

We suggest you spend some time with these questions and come up with answers based on your practical experience from using QTP in your respective projects.

Another important question that your interviewer would be interested to know is the statistics. For example:

  1. How many scripts did you have?
  2. How often were they executed?
  3. How many lines of code in each script?
  4. Did you use function libraries and/or shared ORs?
  5. How long to develop a script?
  6. Did the scripts need lot of maintenance? If yes, why?

Again, be sure to be prepared with the answers to these questions.

Last piece of advice, be honest and straightforward. Keep in mind that not all projects are same and not everybody follows the same methods. So we recommend that you have clear understanding of your project and exhibit the potential to learn. Nobody expects you to know everything; they only expect you to know what you do best.

Let’s move on to the technical QTP questions.

QTP Interview Questions and Answered

Top 20 Most Asked QuickTest Professional Interview Questions

1) Different types of QTP test assets and their extensions:

types of QTP test assets and their extensions

2) Technologies supported by QTP:
Web, Java (Core and Advanced), .Net, WPF, SAP, Oracle, Siebel, PeopleSoft, Delphi, Power Builder, Stingray 1, Terminal Emulator, Flex, Web Services, Windows Mobile, VisualAge Smalltalk, Silverlight and mainframe terminal emulator

3) Does QTP run in any environment?
No, QTP works only in the windows environment.

4) Explain the views in the QTP GUI?
Keyword view: This view is a tabular representation of all the objects and the actions that are performed on them. Every row in the table is a step performed on the AUT and can be modified. Some of the most common columns displayed are: item, operation, value and documentation.
Expert view: As the name indicates, this view is for more technical users who would want to tweak the source code as per their requirements.

5) What is QTP’s model for test creation?
a) Determine testing needs – Define testing environment, Analyse your application and plan actions
b) Set up repositories – Local or Shared OR
c) Define function libraries
d) Generate test steps – Add steps, Add checkpoints
e) Data drive your tests
f) Run the tests

6) What are the different kinds of test steps?
5 types of steps:
- Test Object ( Performs actions on a TO)
- Functions
- Utility (Steps to control run session. Eg: Reporter.report)
- Comment
- Programming logic (Loop, conditions…etc)

7) What are the different ways to invoke an application using QTP?
a) SystemUtil.Run
SystemUtil.Run ( FileName, Parameters, Path, Operation )
Example: SystemUtil.Run(“iexplorer.exe”,http://www.google.com)
SystemUtil.Run(“test.txt”, “”,”C:\”,”1”)

b) InvokeApplication
Example: InvokeApplication “C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.com”

c) Creating a shell object using VB Script
Example: Create a “WScript.shell” object.
Dim testshell
Set testshell= CreateObject (“Wscript.shell”)
testshell.run “%windir%\notepad “

8) What are the different recording modes and how do they work?
QTP provides 3 modes of recording:

------------

  • Normal Recording mode – The default recording method is always the normal mode. This method uses the model of Test Objects and Runtime objects to learn and act on the AUT.
  • Analog recording mode – records the exact mouse and key strokes that the user performs in relation to either the screen or AUT window.  The steps that are recorded using this method cannot be edited.
    The way this usually gets represented in a code is:
    Window/app.RunAnalog “Track1”
    One scenario in which this type of recording can be used is when we are trying
    to capture a signature.
  • Low Level recording mode – This mode records the co-ordinates in the application where the operation is performed, irrespective of whether QTP recognizes the specific Object or Operation.

9) Which recording modes need more memory?
Analog and Low-level recording modes

10) Is it possible to switch between recording modes during a test creation?
Yes, in the middle of recording, we can switch to Analog/Low-level mode, finish the task required and go back to normal recording. The switch to Analog mode is available only during recording and not during editing

11) Does Low level recording capture mouse movements?
No. Mouse movements are not captured.

12) How does QTP identify an object?
QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There are 3 aspects to this:

  • Mandatory properties: This is the list of properties for a certain class that QTP always stores. We could say that this is the object description. It also checks this in conjunction with the parent object to see if the description is sufficient to identify the object uniquely.
  • Assistive properties: In case the description of mandatory properties is insufficient to identify the Object a set of non-mandatory properties will be added to the description one after the other until there is enough data to identify the object.
  • Ordinal Identifier: If the assistive properties also do not result in unique identification of an object a special ordinal identifier is added by QTP, such as the object’s location on the page or in the source code.

13) What is Smart identification?
If the recorded description does not enable QTP to identify a specific object then QTP uses “Smart identification” mechanism.  It uses the following additional properties to identify the object
a) Base Filter Properties (primary) – The set of properties that cannot be changed without changing the object type
b) Optional Filter Properties (secondary) – additional properties that help identify the object uniquely.

14) What is Object Spy?
Object Spy is an extremely helpful tool that QTP has to view the properties and operations of an object in the AUT. It shows all the properties of the object and the corresponding values. It also shows the object hierarchy. It also has a provision that lets the users add a certain object to the OR.

15) What is an object repository?
OR is like a warehouse where all the objects in a test are stored. OR has the list of Objects that QTP learned during the record process and the class to which they belong. It stores the set of properties that uniquely identifies the Object (description) and also names the object for the sake of identification in our test, based on its most prominent feature.

16) What are the two types of repositories available, explain them?
Local and shared repository – these are the two kinds of available repositories.
Every action by default has a local repository of its own and has all the objects that are used within it.
Alternately, the tester can have a common repository for multiple actions so that all of them can share the objects that it contains. The common repository is called a shared OR.

17) An action has both shared and local OR associated to it and both have the same object in them. In the test which one will be considered?
If a local OR and Shared OR have an object with the same name, the action will consider the object in its local OR.

18) Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?
There can be more than one Shared OR’s associated to the same action. If Shared OR1 and Shared OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the OBJ1 from Shared OR1 will be taken into account.

19) Can the user toggle between using Local OR and shared OR for the same action?
Yes, it is possible to switch between one or the other types of ORs at any time. To do so, the menu option is Test->Settings->Resources and choosing the options accordingly.

20) Are Shared ORs read only?
By default, shared ORs open as read only. To open them in order to edit them you will have to open them from Object Repository Manager.
“ORM->File->Enable Editing”

More QTP Interview QuestionHere is an old post for more QTP interview questions.

Over to you:

Interested in seeing more QTP questions? We are going to do more follow up QTP questions. Please post your questions on the above article and also let us know of any other QTP related questions that you would like to be answered.



The Best Software Testing Training You'll Ever Get!

software testing QA training

39 comments ↓

#1 Krishna on 03.31.13 at 9:34 pm

I have many questions in my mind and shared those using the form. Just had an interview in a top MNC and I’m feeling confident about my answers. Hope your readers will benefit from these questions.

#2 Anil Kumar M R on 04.01.13 at 5:56 am

I wanted questions related to web enviroment like how do we access a particula browser among the various browsers. How to close a paticular browser on the desktop. and one of the question asked is explain the genenic functions you have developed. Explain your framework

#3 Reshma Paygude on 04.01.13 at 2:26 pm

Why QTP? what is best in QTP that other tools don’t have? I mean why so many companies are preferring QTP over other tools? What makes it the choice of tool for these companies?

#4 Padmini Singh on 04.02.13 at 5:36 am

Good concepts.. but these are the basic ones. Please provide some more advance side of qtp, like why to choose qtp over manual or other tools, how to run scripts in qtp, folder structure for frameworks…

#5 Subbu on 04.02.13 at 9:48 pm

I have gone through all questions, those are good but surely not common questions. Here are some advanced questions.

1. If an Object is not able to identify by QTP then how you will handle it? (Extensibility, Virtual Object, SendKeys)

2. Browser.Sync is giving false results? Do you agree with this? If yes, what is the work around?

3. QTP’s .Exist is returning False even though object is exist. What could be the reason?

4. Is it possible to update Shared OR during Runtime? If yes, how?

5. What is the difference between FireEvent and ReplayType 2?

6. Index/Location/CreationTime and XPATH, which is efficient mechanism to identify an object?

7. How to stop QTP Test Script execution during runtime?

I can add more and just FYI… for all above questions there are multiple counter questions so be careful while answering them. All the best.

#6 Swati on 04.05.13 at 9:34 pm

@all: We will make a note of all the questions provided by you all. The answers will come out as part of interview questions part 2 article

#7 vinod on 05.05.13 at 3:01 am

a=10
b=10
c=empty
d=empty
msgbox a=b=c=d

expected output:false
actual output:true

can u explain this?

#8 david on 05.13.13 at 10:30 am

inputstring=”aaaabbbbccc”
output=a4b3c3

kindly let me know who can do this script to get the above output

#9 Ramya on 05.30.13 at 3:16 pm

x = “aaaabbbbccc”
cta = 0
ctb = 0
ctc = 0
ctd = 0

For i = 1 To Len(x)
y = Right(Left(x, i), 1)
Select Case y
Case “a”
cta = cta + 1
Case “b”
ctb = ctb + 1
Case “c”
ctc = ctc + 1
Case “d”
ctd = ctd + 1
End Select
Next

MsgBox “a” & cta & “b” & ctb & “c” & ctc & “d” & ctd

#10 Partap on 05.31.13 at 8:05 am

Where top download latest version of QTP for Free ?

anybody could help ?

#11 Swati on 06.07.13 at 12:58 am

@Partap: You can download a 30 day free trial from the HP site. Check the first QTP tutorial article

#12 Nagender on 06.09.13 at 5:33 pm

@David,

inputstring=”aaaabbbbccc”

For i = 1 to len(inputstring)
Set RegEx =New RegExp
Str = Left(inputstring,1)
RegEx.Pattern = Left(inputstring,1)
RegEx.IgnoreCase = True
RegEx.Global = True
If len(inputstring) = 0 Then
Exit For
End If
Before = len(inputstring)
inputstring= RegEx.Replace(inputstring,””)
After = len(inputstring)
StrDisplay = StrDisplay & Str & (Before-After)

Next

Print StrDisplay

#13 sambeet on 06.25.13 at 5:16 am

i have 1 doubt,pls do reply..
does qtp identify multiple browsers that are opened at same time.if yes how?

#14 Manoj on 06.27.13 at 7:20 am

The questions that are mention above are very much useful for students like me.Thanks for sharing such article. Even in MindScripts Technology special interview sessions are conducted for students to prepare them for top MNC’s.

#15 Vibhor Bhatt on 07.04.13 at 7:36 am

Hi Guys,

I am a beginner to QTP & VB scripting. Please help me out as i am very much keen to learn to do scripting in my project. But i am not able to find way where to start with. If any one having any website link where i can learn the basic scripting.
Kindly email me any stuff you guys have at vibhorbhatt87@gmail.com.
Thanks in advance !!

#16 murali on 07.22.13 at 9:54 am

filepath=”C:\CA-Nevada-Tax-APN-Freeform.xml”
xpathlist=”//tax_param//freeform|//tax_param//tax_qualifier”
newvaluelist=”murali|uppi”
Function updatexmlnodevalue(xmlpath,xpath,newvalue)
‘crete objpect for XML
Set xmlDoc = CreateObject(“Microsoft.XMLDOM”)
Set fso=createobject(“scripting.filesystemobject”)
If fso.FileExists(filepath)true Then
‘reporter.ReportEvent micFail,”specified file does not exist” ,” ”
Exit Function
else
‘load xmlfile
xmlDoc.load(xmlpath)
‘Locate the desired node

xpatharray=split(xpathlist,”|”)
newvaluearray=split(newvaluelist,”|”)

For i=0 to ubound(xpatharray)
xpath=xpatharray(i)
Set nNode = xmlDoc.selectsinglenode (xpath)
If nNode is Nothing Then
‘reporter.ReportEvent micFail,”specified xpath does not exist in xml file” ,” specify correct xpath ”
Exit Function
End If
‘Set the required value
nNode.text = newvaluearray(i)
‘reporter.ReportEvent micPass,”value of the Node is changed” ,” New value is set ”
‘Save the xml document with the new settings.
Next
xmldoc.save(“C:\test\CA-Nevada-Tax-APN-Freeform.xml”)
end if
End Function

Call updatexmlnodevalue(filepath,xpathlist,newvaluelist)

#17 murali on 07.22.13 at 10:04 am

filepath –>c:\filename.xml

attributelist –> state_flips|country_flips|country

newvaluelist ..> 100|1000|10000

newfilepath –> c:\test\filename.xml

xpathlist –>//request|//request|//request

#18 murali on 07.26.13 at 11:38 am

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objXML = CreateObject(“Msxml2.DOMDocument”)
Set objInputFile = objFSO.OpenTextFile(“D:\CA-Nevada-Tax-Freeform-Situs-Blank.xml”,1,False,-2)
Set objOutputFile = objFSO.CreateTextFile(“D:\CA-Nevada-Tax-Freeform-Situs-Blank1.xml”,True,False)
strXML = objInputFile.ReadAll
strXML = Replace(strXML,””,”“)
strXML = Replace(strXML,””,” “)
objOutputFile.Write strXML
objInputFile.Close
objOutputFile.Close

#19 murali on 07.29.13 at 10:00 am

ReplaceLast=StrReverse(Replace(StrReverse(strXML),StrReverse(“name”),StrReverse(myname)))

#20 murali on 07.29.13 at 10:04 am

strXML=StrReverse(Replace(StrReverse(strXML),StrReverse(“”),StrReverse(“<!- <nam")))

#21 murali on 07.29.13 at 10:25 am

strXML = “name myname name is murali name”

Set objRE = New RegExp

With objRE
.Pattern = “”
.IgnoreCase = True
.Global = False
End With

Set objMatch = objRE.Execute( strXML )
strNewMail = objRE.Replace( strXML, “” )

#22 murali on 07.29.13 at 10:26 am

strXML = “name myname name is murali name”

Set objRE = New RegExp

With objRE
.Pattern = “name”
.IgnoreCase = True
.Global = False
End With

Set objMatch = objRE.Execute( strXML )
strXML = objRE.Replace( strXML, “” )

print strXML

#23 Kavita on 07.30.13 at 5:52 am

Hi Guys,

I am a beginner to QTP & VB scripting. Please help me out as i am very much keen to learn to do scripting in my project. But i am not able to find way where to start with. If any one having any website link where i can learn the basic scripting.
Kindly email me any stuff you guys have at
kavitafortuneinfoserve@gmail.com

thanks in advance

#24 suresh on 08.07.13 at 8:47 am

plz suggest me for right job

#25 priya on 08.14.13 at 2:31 am

Hi,

Is java script uses in QTP.
Need clear answer as people are saying in other articles yes or No.
If yes means how to implement java script in QTP.

#26 Subbu on 08.23.13 at 4:50 am

Hi All,

in script we have 100 lines of code.I have to replace one string (eg : subbu) with other one (eg : test) .How can i replace that one using AOM ?

If you have the answer please reply to my mentioned mail ID

Thnaks in advance.

#27 Maahi on 10.10.13 at 5:42 pm

Very good info.Thanks

#28 Raaj on 12.05.13 at 6:50 pm

alert(“Nice info”);

#29 mns on 12.10.13 at 1:03 pm

How we can change a string to upper case without using Ucase builtin string function in vb script

#30 sada on 12.12.13 at 9:52 am

@mns: we can convert the string in uppercase without using UCase method. by using conversion of AsCII to character and Character to Ascii method so based on that we can convert the string for Upper case

#31 kamal on 12.12.13 at 4:59 pm

@#8 david on 05.13.13 at 10:30 am
set d=createobject(“scripting.Dictionary”)
str=”aaaabbbccc”
for i=1 to len(str)
c=mid(str,i,1)
d(c)=d(c)+1
next
for each k in d
temp=temp& k&d(k)
next
msgbox temp

#32 mns on 12.16.13 at 1:15 pm

@sada

If it is possible, can u pls share the code for changing a string to upper case without using Ucase builtin string function in vb script

#33 Maria on 02.24.14 at 12:38 pm

we can get more interview questions from mere also…
http://www.qatestingtrainings.com/interview-questions/qa-interview-questions/

#34 Dinesh Gunti on 02.25.14 at 6:58 am

Thanks for the above questions. Those are very helpful to get good amount of confidence going before interview .

#35 Rajesh on 03.08.14 at 4:29 pm

Write script to print below pattern?

54321
5432
543
54
5

#36 Pratik on 03.13.14 at 9:14 am

Can you please arrange similar kind of posts for Selenium, more on advanced side. It would be really helpful

#37 Lavanya on 03.25.14 at 5:57 am

Hi Guys,

I am a beginner to QTP & VB scripting. Please help me out as i am very much keen to learn to do scripting in my project. But i am not able to find way where to start with. If any one having any website link where i can learn the basic scripting.
Kindly email me any stuff you guys have at
lavs.2393@gmail.com

thanks in advance

#38 neha on 03.26.14 at 10:22 am

hello

I am a beginner to QTP & VB scripting. Please help me out as i am very much keen to learn to do scripting in my project. But i am not able to find way where to start with. If any one having any website link where i can learn the basic scripting.
Kindly email me any stuff you guys have at
nehakashyap12aug@gmail.com

thanks

#39 Chanikya Reddy on 03.26.14 at 12:21 pm

What is the memory size of QTP?