QTP Interview Questions And Answers

1. What is QTP?
Answer: Quick Test Pro is a GUI based testing tool for automated functionality. It allows to automation of the user actions on a web-based or client based and desktop software application. The functional regression test automation is used primarily by QTP. A scripting language is built atop of VBScript for specifying the test procedure and to manipulate the objects and controls of the application under a test.
QTP works together with Mercury Interactive WinRunner and HP Quality Center and also supports the Quality Assurance of an enterprise.
Quick test pro is used to automate user actions (like mouse clicks and keyboard actions) of an application. This is provided by a GUI. It is used to specifically automate functional and regression testing. Several plug-ins are available in QTP for enhancing the environment.

2. What are the types of Object Repositories in QTP?
Answer: Quick Test has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test. The object repository per-action mode is the default setting. In this mode, the Quick Test automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object’s property values in one action, you may need to make the same change in every action (and any test) containing the object.

3. What is Smart identification?
Answer: If the recorded description does not enable QTP to identify a specific object then QTP uses the “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.

4. How many types of Actions are there in QTP?
Answer:
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.

5. How many types of recording modes in the QTP?
Answer:
The QTP enable us with three types of recording mode:

– Normal (by Default recording): In this recording, mode QTP identifies the object irrespective of their location on the screen. It is done by recording an object based on an application window.

– Analog Recording: It is used when the exact mouse movement and action performed by the mouse are important. Used in testing the paint application and signature made with the help of the mouse.

– Low-Level Recording: It helps in identifying those objects which are not recognized by the QTP. It is used when the location of an object is changing inside the screen.

6. How do Parameterization and Data-Driving relate to each other in QTP?
Answer: 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.

7. Can we create a QTP test from QC?
Answer: Yes, we can create a QTP test from QC but we must first make sure QTP can execute tests from Quality Center. Please ensure the following option in QTP Run Settings is enabled:

When QTP is enabled, follow the below steps to schedule and execute tests from Quality Center:

1. Login to Quality Center and Navigate to Test Lab Module
2. After selecting the correct Test Set, Click the Execution Flow Tab.
3. Right-click on the test that requires configuration of Time Dependency and clicks Test Run Schedule.
4. In the Run Schedule window, select the Time Dependency tab. The time and date of execution can be configured.
5. Time dependency will be added to the relevant test.
6. After time dependency has been added, navigate back to the Execution Grid pane. From the Execution Grid, select the tests to be run at the designated date and time.
7. From the Automatic Runner dialog, click Run All.
8. Once Run All is clicked from the Automatic Runner dialog, the test status will change to Waiting and QC will fire the tests to be run at the scheduled date and time:
9. QC will fire the tests in the sequence configured in the Execution Flow pane. The Test Run Scheduler will show all the tests that were selected and are executing and are to be executed.

8. How to handle dynamic objects in QTP?
Answer:  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 change 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 regularly, but which can be ignored if they are no longer applicable.

9. Explain the concept of object repository & how QTP recognizes objects?
Answer: 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 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.
What are the properties you would use for identifying a browser & page?

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 regularly, but which can be ignored if they are no longer applicable.

10. What is Object Spy in QTP?
Answer: Using the Object Spy, you can view the properties of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy displays the selected object’s hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.

11. What is the extension of the QTP Local Repository? If it is .mtr then what is .bdb extension stands for?
Answer: 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.

12. when using descriptive programming?
Answer: The name would be another property apart from the title that we can use.

13. What are the advantages of a Hybrid framework?
Answer: The hybrid framework is nothing but a combination of frameworks that make you solve your testing needs by taking what works best for your scenario. The obvious advantage is versatility. It can be tailored to meet any testing project’s needs.

14. On the website, the protocol has been changed https: to https what you will do? Tell me your approach?
Answer: 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.

15. Question -What are the different types of Action?
Answer:
There are three kinds of actions:

non-reusable action / internal 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.

16. What is the recovery scenario in QTP?
Answer: While executing a test, some unexpected errors and events may occur. To overcome this we take the help of Recovery Scenario. The Recovery Scenario Consist of Following:

– Trigger Event: when unexpected events or errors invoke.

– Recovery Operation: Operation needed to perform for running the remaining test script.

– Post-Recovery Test Run Option: after recovering from unexpected error where to start the remaining test execution.

17. What is contained in the Object Repository?
Answer: Object Repository stores the element identification properties extracted from the application during recording. The ID will be generated for each element and this ID is used for Object identification in the application. Object Repository acts as a repository for the application elements. Object Repository contains two properties of each object for the identification:

– Physical properties description of the object
– Logical name of the object.

18. Explain the concept of object repository and how QTP recognizes objects?
Answer: 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 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.

19. What are the types of Object Repository in QTP?
Answer: QuickTest has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test. The object repository per-action mode is the default setting. In this mode, QuickTest automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object’s property values in one action, you may need to make the same change in every action (and any test) containing the object.

20. How Does Run time data (Parameterization) is handled in QTP?
Answer: You can then enter test data into the Data Table, an integrated spreadsheet with the full functionality of Excel, to manipulate data sets and create multiple test iterations, without programming, to expand test case coverage. Data can be typed in or imported from databases, spreadsheets, or text files.

21. What is a data-driven test in QTP?
Answer: Data-Driven is an automation testing part in which test input or output values, these values are read from data files. It is performed when the values are changing by time. The different data files may include data pools. The data is then loaded into variables in recorded or manually coded scripts. In QTP to perform the data to drive the test, we use the parameterization process. When we do a data-driven test, we perform two extra steps:

– Converting the test to a data-driven test.
– Creating a corresponding data table.

22. How to use Parameterization in QTP?
Answer: It is the process of making use of different values in place of recorded values which is replaced by a variable that contains different values that can be used during the execution of the scripts. QTP enable us with a different type of Parameterization, passing of data:

– Using the Loop statement.
– Dynamically test data submission
– Using data table.
– Fetching data from external files.
– Fetching data from databases.
– By taking test data front end(GUI)

23. How to handle the exceptions using the recovery scenario manager in QTP?
Answer: There are 4 trigger events during which a recovery scenario should be activated. A pop-up window appears in an opened application during the test run: A property of an object changes its state or value, A step in the test does not run successfully, An open application fails during the test run, These triggers are considered as exceptions. You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during the test run. The recovery scenario manager provides a wizard that guides you through the defining recovery scenario.

The recovery scenario has three steps:

1. Triggered Events

2. Recovery steps

3. Post-Recovery Test-Run.

24. What is the difference in the Global and action sheet in QTP?
Answer:
– Global Sheet: Globally accessible by all tests. Used when we have to perform many actions by using a single script.

– Action Sheet: Locally accessible in a test. It is used when only one action is performed with one script.
Explain XML Checkpoints.
XML Checkpoints are used for the verification of the current and expect value or properties of the XML documents. A checkpoint fails when actual and expected values or properties are not the same. QTP enables us with three types of XML Checkpoints:

– XML Web Page or Frame Checkpoints.
– XML File Checkpoints.
– XML Test Object Checkpoints.

25. Explain the QTP Testing process?
Answer:
Quick Test testing process consists of 6 main phases:
Create your test plan – Before automating there should be a detailed description of the test including the exact steps to follow, data to be input, and all items to be verified by the test. The verification information should include both data validations and existence or state verifications of objects in the application.
Recording a session on your application – As you navigate through your application, Quick Test graphically displays each step you perform in the form of a collapsible icon-based test tree. A step is any user action that causes or makes a change in your site, such as clicking a link or image or entering data in a form.
Enhancing your test – Inserting checkpoints into your test lets you search for a specific value of a page, object or text string, which helps you identify whether or not your application is functioning correctly. NOTE: Checkpoints can be added to a test as you record it or after the fact via the Active Screen. It is much easier and faster to add checkpoints during the recording process. Broadening the scope of your test by replacing fixed values with parameters lets you check how your application performs the same operations with multiple sets of data. Adding logic and conditional statements to your test enable you to add sophisticated checks to your test.
Debugging your test – If changes were made to the script, you need to debug it to check that it operates smoothly and without interruption.
Running your test on a new version of your application – You run a test to check the behavior of your application. While running, Quick Test connects to your application and performs each step in your test.
Analyzing the test results – You examine the test results to pinpoint defects in your application.
Reporting defects – As you encounter failures in the application when analyzing test results, you will create defect reports in Defect Reporting Tool.
Explain the QTP Tool interface. – It contains the following key elements: Title bar, displaying the name of the currently open test, Menu bar, displaying menus of Quick Test commands, File toolbar, containing buttons to assist you in managing tests, Test toolbar, containing buttons used while creating and maintaining tests, Debug toolbar, containing buttons used while debugging tests. Note: The Debug toolbar is not displayed when you open the Quick Test for the first time. You can display the Debug toolbar by choosing View — Toolbars — Debug. Action toolbar, containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow. Note: The Action toolbar is not displayed when you open the Quick Test for the first time. You can display the Action toolbar by choosing View — Toolbars — Action. If you insert a reusable or external action in a test, the Action toolbar is displayed automatically. Test pane, containing two tabs to view your test-the Tree View and the Expert View, Test Details pane, containing the Active Screen. Data Table, containing two tabs, Global and Action, to assist you in parameterizing your test. Debug Viewer pane, containing three tabs to assist you in debugging your test-Watch Expressions, Variables, and Command. (The Debug Viewer pane can be opened only when a test run pauses at a breakpoint.) Status bar, displaying the status of the test

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 the GUI map file per test in WinRunner

26. What is Procedure or Subroutine in VB Script?
Answer: 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 ().

27. Explain step generator in QTP?
Answer: Step Generator in QTP helps in creating those steps which are performed over the object while testing. Use of Step Generator in QTP:

– Help in debugging the script by making use of Break.
– To add those step which we forget to perform while recording.
– To ensure that objects exist in the repository
– To add up the step in the function library.

28. Explain the use of Action Split in QTP?
Answer: Action Split: It is used to split the action into two parts. There are two types of split an action:

– Splitting into two sibling actions: Both split actions are independent of each other.

– Splitting into Parent-Child nested action: In this second split, the action is only called after the execution of the parent split action. Child split action depends upon the parent split action.

QTP generated the duplicate copy of the object repository when we perform Split action. We can add the object to anyone spilled action which is not added into another split action’s repository.

29. Explain the keyword createobject with an example?
Answer:
Creates and returns a reference to an Automation object
syntax: CreateObject(servername.typename [, location])
Arguments
server name: Required. The name of the application providing the object.
type name: 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.

30. Can you do more than just capture and playback?
Answer: 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.

31. What is the difference between checkpoint and output value?
Answer: 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]

32. What test cases can you automate using QTP?
Answer: 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.

33. What are the different attributes used with Regular Expression?
Answer:

The different attribute of Regular Expression is:

– A backslash (\): when it is encountered the next character is treated as a literal character.
– Period(.): is used to search for any single character.
– Square Bracket[ ]: is used to search a single character within a list of characters.
– Caret(^): is used to match any character in the list except those specified in the string.
– Asterisk(*): to match zero or all occurrence of the preceding characters.

34. How to find Operating system information using the QTP script?
Answer: You can do that with the help of the environment variable. The exact variable is, OS and OSVersion are for the version information.

35. What are the two types of repositories available, explain them?
Answer: 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.

36. Can the user toggle between using Local OR and shared OR for the same action?
Answer: 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.

37. How can you identify the browser and its information using the QTP script?
Answer: You can identify and act on any browser that you opened again by referring to its ‘creation time’ property and use it like you would with a browser object in your OR.

38. 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?
Answer: 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.

39. What is an object repository?
Answer: Object Repository: When QTP learn any object from application it stores those object in the Object Repository with the properties of the object. It is used to identify the object. There are two types of object repository:

– Shared Object Repository: It can be shared between multiple tests but it does not allow making changes in the repository. Mostly used in Keyword Driven methodology. It is saved with.TSR extension.

– Local Object Repository: This type of object repository is linked with only one test. In this we can perform the change in the repository, like changing the properties of the object, adding an object in the repository. It is saved with.MTR extension.

40. What is an expert view and keyword view?
Answer: Xpert View: It contains the steps performed over the application in VBScript language.

– The expert view enables us to edit the script.
– In the keyword view, a row exists for each object and method which is mention in Expert View.

Keyword View: contains the steps executed on the application in keyword driven tabular form in the English language.

– Keyword View contains four fields: ITEM, Operation, Value, and Document.
– Selecting items and operation we can create and modify the test.
Describe Synchronization Point.
Synchronization Point: When application response speed is not the same as the test execution speed this may cause an error. To remove this error, we use the Synchronization point. Synchronization is done by making the QTP test to wait until the application is ready for execution. When we insert Synchronization point in the test then QTP generates the WaitProperty Statement in the ExpertView. For synchronization we can use:

– Exist statement
– Wait for statement.
– Increase the defaulted time of QTP waits for a web page to load.
– Change in default timeout setting.
Explain checkpoint.
A checkpoint is a point where QTP current value or property of the object with the expected value or property of the object. When we insert the checkpoint in the test, then in keyword view checkpoint is added in front of the current row and expert view, a checkpoint statement is added.

41. How can you close the second opened browser?
Answer: 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(“creation time:=1”).Close

42. What is Test Fusion Report in QTP?
Answer: 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.

43. What is the difference between the keyword view and expert view?
Answer: They are two ways QTP shows your test. Each one has its features and caters to users of different levels of expertise.

Keyword view: This is a tabular representation of your test that has 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.

44. What are the steps involved in the Recovery Scenario Wizard?
Answer:

The Recovery Scenario Wizard consists of the following steps:

– Defining of the trigger event.
– Defining Recovery operation.
– Selection of Post Recovery Run.
– Specifying either to associate recovery scenario to the current test or all-new test.
Explain different types of events trigger option.

45. Give me an example where you have used a COM interface in your QTP project?
Answer: com interface appears in the scenario of front end and back end. for eg: if you’re using Oracle as back end and front end as VB or any language then for better compatibility we will go for an interface. of which COM will be one among those interfaces. Create an object creates handle to the instance of the specified object so that we program can use the methods on the specified object. It is used for implementing Automation(as defined by Microsoft).
Explain in brief about the QTP Automation Object Model. – Essentially all configuration and run functionality provided via the Quick Test interface is in some way represented in the Quick Test automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in Quick Test 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 Quick Test automation object model, along with standard programming elements such as loops and conditional statements to design your program.

46. What are the factors on which script execution time is dependent?
Answer:

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

47. What is the purpose of loading QTP Add-Ins?
Answer: Add-Ins: are small programs or files which can be added to the computer to enhance the capabilities of the system. The purposes of loading Add-Ins into QTP are the following:

– To increase the capabilities of the system.
– To improve the graphics quality, communications interface.
– To load the particular function into the memory.
– To excess only those functions that are required for the execution of the script.

48. Is it possible to call from one action to another action in QTP?
Answer: Yes, QTP enables us to call from one action to another action.

There are two ways of calling action:

– Call to Copy of action: in this, we generate the copy of action in our repository which enables us to perform the change to the copy of action.

– Call to Existing action: we call to action which is made up earlier. This generates the reference to the action. We can access the action in read-only mode. In this, no copy of the existing script and data table is made.

Note: Browse latest Qtp Interview Questions and Qtp Tutorial. Here you can check Qtp Training details and QTP Training Videos for self learning. Contact +91 988 502 2027 for more information.

All QTP Interview Questions

Instructor Led Training

Duration: 25+ hours
15,000
  • Experienced Faculty
  • Real time Scenarios
  • Free Bundle Life time Access
  • 100% Hands-on Classes
  • Sample CV/Resume
  • Interview Q&A
  • Instructor Led Live Online Classes
  • Instant Doubt Clarification