QTP Interview Questions and Answers (with Interview Tips)

Below are some useful tips to prepare for QTP/UFT 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 to prepare for the interview while learning QTP.

Note – In this post, we have covered some useful tips to prepare for QTP interview along with top 80 common and crucial Quick Test Professional questions and answers. 

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/UFT interview:

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 a lot of maintenance? If yes, why?

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

The 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 a 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:

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:

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:

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 recording process and the class to which they belong. It stores the set of properties that uniquely identify 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 with 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 with 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”

21) What are advantages of test automation?

22) If the objects hierarchy is changing from build to build, then how you will handle that condition?

In this case, the descriptive programming can be used instead of having an OR. Even while descriptive programming tries to use regular expressions to identify the unique property of the objects.

23) I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”

1) Firstly, QuickTest Add-In for Quality Center has to be installed.

2) In the QTP Tools > Options >run tab you should have ‘Allow other Mercury products to run tests and components’ selected.

3) Make sure you are running QTP as an Admin

4) All the test resources have to be in the correct path

24) What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?

.bdb is the local OR. .mtr is a binary file that contains other information about checkpoints and all. To re-verify the .bdb is the OR, try to rename the file with the extension as .tsr and open it from ORM. The same objects in the OR will be displayed here. The same will not work if you try it on .mtr file.

25) What is the virtual object?

A virtual object is a non-standard object that is instructed by the tester via QTP to behave like a standard one. More details in the tutorial #23

26) How do you capture tooltip using QTP?

Tool Tip capture method varies depending on the type of object this tooltip appears for. It could be for links, images or any other web elements.

For web elements use: Object.title property.

For image: Image(“some name”).GetROProperty(“alt”)…..etc.

27) How can you close the second opened browser?

You can know which browser instance was opened after another can be known by using the “creation time” property. In simple terms, this is nothing but a counter for each browser instance that gets launched. For the first one, it is 0 and gets incremented from then on. To close the second opened browser, you can use the following code:

Browser(“creationtime:=1”).Close

28) How do know the number of browsers opened?

To do this you will have to check how many child objects of the type ‘browser’ are present on the desktop. The following is the code that explains it:

Set ObjectBrowser = Description.Create

ObjectBrowser(“micclass”).Value = “Browser”

Set BObj = Desktop.ChildObjects(ObjectBrowser)

Msgbox Obj.Count

29) What is synchronization point in QTP?

It is a feature that QTP provides to make your test wait until a certain property on a certain object becomes an expected value before proceeding with the next steps. More information in tutorial #24.

30) What is reusable action?

An action that can be called multiple times within or outside the same test is called the reusable action. By default all actions are reusable. More information in tutorial #21.

31) Why do we use breakpoints in QTP?

This is to stop the execution of your test at a certain point while it’s running.  Typically it is used to observe the state of your application or to understand how a certain feature works at a certain phase at runtime. (The checking is, of course, a manual step.)

32) What is throw object?

VB Script does not have any specific throw object. (At least to the best of my knowledge) This question will not come up unless a specific add-in that supports this feature is explored.

33) How do you know the location Id of an object if you know its index id?

Location is the position of the object from left to right and top to bottom within the parent window, frame, or dialog box relative to other similar objects.

Index Id is the order in which the object appears in your AUT relative to other similar objects.  E.g if you have 2 links, then index id=0 will be the first link and index id=1 will be the second link.

The answer to this question is entirely dependent on where the object lies, whether it is within the same parent or not.

34) What test cases can you automate using QTP?

As an automation enthusiast, I would say, you can automate anything. It is only limited by your imagination and expertise. However, in case you need to understand the look, feel or human reaction to a certain feature, then that is not possible. This is the case with any tool, not specific to QTP.

35) How to handle Java tree in QTP?

You will need to select and load the Java Add-in. Then you can record and work on a Java Tree object just like you would with any other object.

36) How to give a call to another action from one action?



Calling one action from the other can be done by “Inserting a call” to an existing action or by creating a new action. Please refer tutorial #21 for a detailed explanation.

37) How to find Operating system information using QTP script?

You can do that with the help of environment variable. The exact variable is, OS and OSVersion are for the version information.

38) How can you identify the browser and its information using QTP script?

You can identify and act on any browser that you opened again by referring to its ‘creationtime’ property and use it like you would with a browser object in your OR.

39) How are actions and functions different in QTP?

Actions have their own Datatables and OR, but functions don’t. More importantly, Functions are a VB Scripting element, not only applicable to QTP. Please refer article 21 a detailed explanation of these.

40) Explain how to use QTP to check broken links on a page?

Page checkpoint. You can incorporate this page checkpoint on every page to check for broken links. To do so, you can go to Tools->options->Web->Advanced and choose the option to check for broken links automatically on every page QTP accesses. More information in the tutorial #15.

41) Can we run multiple QTP scripts one after the other without manual intervention? How?

Yes. To do so, you will have to create a batch file using the batch runner tool and information about the same is available in tutorial #23.

42) Explain process of smart Identification in QTP

If the recorded description does not enable QTP to identify the specified object in a step, and a smart identification definition is defined (and enabled) for the object, QTP tries to identify the object using “Smart identification”. For more information please refer to the article number: 23

43) When to use shared and local object repository?

The decision is completely up to you. Shared OR will make more sense when you have multiple scripts referring to the same objects.

44) What are the advantages of Object Repository?

OR is an inbuilt feature provided by QTP to store your test objects. There are many advantages and the most important one is that it is a mandatory element unless you are going for descriptive programming.

More information on OR in tutorial #22.

45) In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?

Yes. Any of the mentioned data sources are permissible.

46) How to associate function library at a run time?

1. You can do so by using the “LoadFunctionLibrary” method. LoadFunctionLibrary “Complete path”

2. You can also use the ExecuteFile method. ExecuteFile “Complete path”

47) The hybrid framework can be implemented for any application. Is it true?

Yes

48) Hybrid framework supports Descriptive programming. Is it true?

Yes. Frameworks are mostly based on how and where you want your test assets to be placed and how they are to be accessed for maximum efficiency. They do not restrict how you write your test itself.

49) What are the advantages of a Hybrid framework?

The hybrid framework is nothing but a combination of frameworks that make you arrive at a solution for your testing needs by taking what works best for your scenario. The obvious advantage is the versatility. It can be tailored to meet any testing project’s need.

50) What is Procedure or Subroutine in VB Script?

Sub procedure is a series of VB Script statements (enclosed by Sub and End Sub statements) that perform actions but don’t return a value. A Sub procedure can take arguments (constants, variables, or expressions that are passed by a calling procedure). If a Sub procedure has no arguments, its Sub statement must include an empty set of parentheses ().

51) Is VB Script Case sensitive or Case insensitive?

It is not case sensitive with respect to command and variable names. Everything else, like strings (text) is.

52) How to record application running on the Virtual machine?

You can access and record QTP script as long as the application is available to you via a browser and not by using the remote connecting software.

53) What are the factors on which script execution time is dependent?

1. Network and computer speeds. The response time from the app, the database etc. This is true even if you are manually executing the test.

2. It also depends on the wait statements you have included.

3. Not loading the add-ins that your test does not use helps too.

4. Descriptive programming steps take longer than regular ones to execute

5. Capturing screenshots at runtime through QTP also consumes time

6. Disabling smart identification also speeds up the QTP script running time

54) What is Test Fusion Report in QTP?

Test Fusion report as the name indicates is a detailed test result that QTP provides in a tree format. It has all the iteration information, data used for each of them along with the standard information.

55) Both Static and dynamic arrays are handled by VB script. Is it true?

Yes. A static array is declared as Dim A(10). This means it’s an array of 11 items. If the tester needs to modify it to contain 20 items he can do so by using ‘redim’.

redim A(19). There is a “Preserve” statement that can be used in conjunction with the redim statement. When preserve is used all the previous values are not erased.

56) What is the difference between keyword view and expert view?

They are two ways QTP shows your test. Each one has their own features and caters to users of different levels of expertise.

Keyword view: This is a tabular representation of your test that has the information like the Item, Operation, Data and, Comments.

Expert view: This displays your test in terms of the actual lines of code. It is more like a VB Script editor and is used by advanced users.

More information is available in the tutorial #2 and #12.

57) In the website, the protocol has been changed http: to https what you will do? Tell me your approach?

Since the protocol change does not necessarily affect the UI change, except maybe for a warning message about certificates, there are not many changes. All you need to do is provide the new URL and make sure you handle the security-related pop-ups.

58) What are the features and benefits of Quick Test Pro(QTP)?

1. Keyword driven testing

2. Suitable for both client-server and web-based application

3. VB script as the script language

4. Better error handling mechanism

5. Excellent data-driven testing features

59) How to handle the exceptions using recovery scenario manager in QTP?

You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during a test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps

1. Triggered Events

2. Recovery steps

3. Post-Recovery Test-Run

60) What is the use of Text output value in QTP?

Output values enable to view the values that the application talks during runtime. When parameterized, the values change for each iteration. Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.

61) How to use the Object Spy in QTP 8.0 version?

There are two ways to Spy the objects in QTP

1) Thru file toolbar: In the File ToolBar click on the last toolbar button (an icon showing a person with hat).

2) Thru Object repository Dialog: In Objectrepository dialog click on the button “object spy…” In the Object, spy Dialog click on the button showing hand symbol. The pointer now changes into a hand symbol and we have to point out the object to spy the state of the object. If at all the object is not visible or window is minimized then hold the Ctrl button and activate the required window to and release the Ctrl button.

62) What is the file extension of the code file and object repository file in QTP?

File extension of

Per test object rep: filename.mtr

Shared Object rep: filename.tsr

Code file extension id: script.mts

63) Explain the concept of object repository and how QTP recognizes objects?

Object Repository: displays a tree of all objects in the current component or in the current action or entire test( depending on the object repository mode you selected).

we can view or modify the test object description of any test object in the repository or to add new objects to the repository.

QuickTest learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordinal identifier such as objects location on the page or in the source code.

64) What are the properties you would use for identifying a browser and page when using descriptive programming?

“name” would be another property apart from “title” that we can use. OR

We can also use the property “micClass”.

ex: Browser(“micClass:=browser”).page(“micClass:=page”)

65) What are the different scripting languages you could use when working with QTP?

You can write scripts using following languages:

Visual Basic (VB), XML, JavaScript, Java, HTML

66) Tell some commonly used Excel VBA functions.

Common functions are:

Coloring the cell, Auto fit cell, setting navigation from link in one cell to other saving

67) Explain the keyword createobject with an example.

Creates and returns a reference to an Automation object

syntax: CreateObject(servername.typename [, location])

Arguments

servername:Required. The name of the application providing the object.

typename : Required. The type or class of the object to create.

location : Optional. The name of the network server where the object is to be created.

68) Explain in brief about the QTP Automation Object Model.

Essentially all configuration and run functionality provided via the QuickTest interface is in some way represented in the QuickTest automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in QuickTest have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods. You can use the objects, methods, and properties exposed by the QuickTest automation object model, along with standard programming elements such as loops and conditional statements to design your program.

69) How to handle dynamic objects in QTP?

QTP has a unique feature called Smart Object Identification/recognition. QTP generally identifies an object by matching its test object and run time object properties. QTP may fail to recognize the dynamic objects whose properties change during run time. Hence it has an option of enabling Smart Identification, wherein it can identify the objects even if their properties changes during run time.

Check out this:

If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description and uses the Smart Identification mechanism to try to identify the object.

While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QuickTest identify an object, if it is present, even when the recorded description fails.

The Smart Identification mechanism uses two types of properties:

Base filter properties – The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link’s tag was changed from to any other value, you could no longer call it the same object. Optional filter properties – Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

70) What is a Run-Time Data Table? Where can I find and view this table?

In QTP, there is data table used, which is used at runtime.

-In QTP, select the option View->Data table.

-This is basically an excel file, which is stored in the folder of the test created, its name is Default.xls by default.

71) How do Parameterization and Data-Driving relate to each other in QTP?

To data-driven we have to parameterize. i.e. we have to make the constant value as a parameter, so that in each interaction(cycle) it takes a value that is supplied in a run-time data table. Through parameterization only we can drive a transaction (action) with different sets of data. You know running the script with the same set of data several times is not suggested, and it’s also of no use.

72) What is the difference between Call to Action and Copy Action.?

Call to Action: The changes made in Call to Action, will be reflected in the original action (from where the script is called). But where as in Copy Action , the changes made in the script ,will not effect the original script(Action)

73) Explain the concept of how QTP identifies object.

During recording, QTP looks at the object and stores it as a test object. For each test object QT learns a set of default properties called mandatory properties, and look at the rest of the objects to check whether these properties are enough to uniquely identify the object. During the test run, QTP searches for the runtime objects that match with the test object it learned while recording.

74) Differentiate the two Object Repository Types of QTP.

Object repository is used to store all the objects in the application being tested.

Types of object repository: Per action and shared repository.

In shared repository only one centralized repository for all the tests, whereas in per action for each test a separate per action repository is created.

75) What the differences are and best practical application of Object Repository?

Per Action: For Each Action, one Object Repository is created.

Shared: One Object Repository is used by entire application

76) Explain what the difference between Shared Repository and Per Action Repository

Shared Repository: Entire application uses one Object Repository, that similar to Global GUI Map file in WinRunner

Per Action: For each Action, one Object Repository is created, like GUI map file per test in WinRunner

77) Have you ever written a compiled module? If yes tell me about some of the functions that you wrote.

Sample answer (You can tell about modules you worked on. If your answer is Yes then You should expect more questions and should be able to explain those modules in later questions): I Used the functions for Capturing the dynamic data during runtime. The function used for Capturing Desktop, browser and pages.

78) Can you do more than just capture and playback?

Sample answer (Say Yes only if you worked on): I have done Dynamically capturing the objects during runtime in which no recording, no playback and no use of the repository is done AT ALL.

-It was done by the windows scripting using the DOM(Document Object Model) of the windows.

79) How to do the scripting. Are there any inbuilt functions in QTP? What is the difference between them? How to handle script issues?

Yes, there’s an inbuilt functionality called “Step Generator” in Insert->Step->Step Generator -F7, which will generate the scripts as you enter the appropriate steps.

80) What is the difference between checkpoint and output value?

An output value is a value captured during the test run and entered in the run-time but to a specified location.

EX:-Location in Data Table[Global sheet / local sheet]

81) How many types of Actions are there in QTP?

There are three kinds of actions:

Non-reusable action – An action that can be called only in the test with which it is stored, and can be called only once.

Reusable action – An action that can be called multiple times by the test with which it is stored (the local test) as well as by other tests.

External action – A reusable action stored with another test. External actions are read-only in the calling test, but you can choose to use a local, editable copy of the Data Table information for the external action.

82) I want to open a Notepad window without recording a test and I do not want to use System utility Run command as well. How do I do this?

You can still make the notepad open without using the record or System utility script, just by mentioning the path of the notepad “( i.e. where the notepad.exe is stored in the system) in the “Windows Applications Tab” of the “Record and Run Settings window.

Hope these questions are useful to prepare for QTP interview. If you come across any new question please feel free to post comments below. We will try to answer it.

All the best.