Software Testing Learning Hub

50 QTP Interview Questions and Answers

50 Questions And AnswersHere are the top 50 Interview questions for the QTP.

1. Question- What is the Diff between Image check-point and Bit map Check point?-

A.Image checkpoints enable you to check the properties of a Web image. You can check an area of a Web page or application as a bitmap. While creating a test or component, you specify the area you want to check by selecting an object. You can check an entire object or any area within an object. Quick Test captures the specified object as a bitmap, and inserts a checkpoint in the test or component. You can also choose to save only the selected area of the object with your test or component in order to save disk Space. For example, suppose you have a Web site that can display a map of a city the user specifies. The map has control keys for zooming. You can record the new map that is displayed after one click on the control key that zooms in the map. Using the bitmap checkpoint, you can check that the map zooms in correctly. You can create bitmap checkpoints for all supported testing environments (as long as the appropriate add-ins are loaded).The results of bitmap checkpoints may be affected by factors such as operating system, screen resolution, and color settings.

2. Question – How many ways we can parameterize data in QTP?

A.There are four types of parameters: Test, action or component parameters enable you to use values passed from your test or component, or values from other actions in your test. Data Table parameters enable you to create a data-driven test (or action) that runs several times using the data you supply. In each repetition, or iteration, Quick Test uses a different value from the Data Table. Environment variable parameters enable you to use variable values from other sources during the run session. These may be values you supply, or values that Quick Test generates for you based on conditions and options you choose. Random number parameters enable you to insert random numbers as values in your test or component. For example, to check how your application handles small and large ticket orders, you can have Quick Test generate a random number and insert it in a number of tickets edit field.

3. Question – How do u do batch testing in WR & is it possible to do in QTP, if so explain?

A.Batch Testing in WR is nothing but running the whole test set by selecting Run Test set from the Execution Grid. The same is possible with QTP also. If our test cases are automated then by selecting Run Test set all the test scripts can be executed. In this process the Scripts get executed one by one by keeping all the remaining scripts in Waiting mode.

4. Question – If I give some thousand tests to execute in 2 days what do u do?

A.Adhoc testing is done. It Covers the least basic functionalities to verify that the system is working fine.

5. Question – What does it mean when a check point is in red color? what do u do?

A.A red color indicates failure. Here we analyze the cause for failure whether it is a Script Issue or Environment Issue or a Application issue.

6. Question – What is Object Spy in QTP?

A.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 hierarchy tree and its properties and values in the Properties tab of the Object Spy dialog box.

7. Question – What is the file extension of the code file & object repository file in QTP?

A.Code file extension is.vbs and object repository is.tsr

8. Question – Explain the concept of object repository & how QTP recognizes objects?

A.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.

9. Question – What are the properties you would use for identifying a browser & page when using descriptive programming?

A.Name would be another property apart from title that we can use.

10. Question – Give me an example where you have used a COM interface in your QTP project?

A.com interface appears in the scenario of front end and back end. for eg:if you r 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 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).

11. Question – Explain in brief about the QTP Automation Object Model? A.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.

12. Question – Explain the concept of object repository & how QTP recognizes objects?

A.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.

13. Question – Explain in brief about the QTP Automation Object Model? A.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.

14. Question – Which environments does QTP support?

A.Quick Test Professional supports functional testing of all enterprise environments, including Windows, Web, .NET, Java/J2EE, SAP, Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.

15.Question – Explain about the Test Fusion Report of QTP?

A.Once a tester has run a test, a Test Fusion report displays all aspects of the test run: a high-level results overview, an expandable Tree View of the test specifying exactly where application failures occurred, the test data used, application screen shots for every step that highlight any discrepancies, and detailed explanations of each checkpoint pass and failure. By combining Test Fusion reports with Quick Test Professional, you can share reports across an entire QA and development team.

16. Question – What is keyword view and Expert view in QTP?

A.Quick Test’s Keyword Driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-standard VBScript that Quick Test Professional automatically generates. Any changes made in the Expert View are automatically synchronized with the Keyword View.

17. Question – How Does Run time data (Parameterization) is handled in QTP?

A.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.

18. Question – How to use the Object spy in QTP 8.0 version?

A.There are two ways to Spy the objects in QTP: 1.through file toolbar, In the File Toolbar click on the last toolbar button (an icon showing a person with hat). 2.True Object repository Dialog, In Object repository dialog click on the button object spy. In the Object spy Dialog click on the button showing hand symbol. The pointer now changes in to 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 if window is minimized then, hold the Ctrl button and activate the required window to and release the Ctrl button.

19. Question – What is the use of Text output value in QTP?

A.Output values enable to view the values that the application talks during run time. 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.

20. Question – How to handle the exceptions using recovery scenario manager in QTP?

A.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 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

21. Question – What are the Features & Benefits of Quick Test Pro (QTP 8.0)?

A.Operates stand-alone, or integrated into Mercury Business Process Testing and Mercury Quality Center. Introduces next-generation zero-configuration Keyword Driven testing technology in Quick Test Professional 8.0 allowing for fast test creation, easier maintenance, and more powerful data-driving capability. Identifies objects with Unique Smart Object Recognition, even if they change from build to build, enabling reliable unattended script execution. Collapses test documentation and test creation to a single step with Auto-documentation technology. Enables thorough validation of applications through a full complement of checkpoints.

22. Question – If an application name is changes frequently i.e while recording it has name, in this case how does QTP handles?

A.QTP handles those situations using “Regular Expressions”.

23. Question – How does QTP identifies the object in the application?

A.QTP identifies the object in the application by LogicalName and Class. For example: The Edit box is identified by 1.Logical Name : PSOPTIONS_BSE_TIME20 2.Class: WebEdit

24. Question – In how many ways we can add check points to an application using QTP?

A.We can add checkpoints while recording the application or we can add after recording is completed using Active screen (Note: To perform the second one The Active screen must be enabled while recording).

25. Question – Explain the check points in QTP?

A. A checkpoint verifies that expected information is displayed in a Application while the test is running. You can add eight types of checkpoints to your test for standard web objects using QTP.
1.A page checkpoint checks the characteristics of a Application
2.A text checkpoint checks that a text string is displayed in the appropriate place on a Application.
3.An object checkpoint (Standard) checks the values of an object on a Application.
4.An image checkpoint checks the values of an image on a Application.
5.A table checkpoint checks information within a table on a Application
6.An Accessibility checkpoint checks the web page for Section 508 compliance.
7.An XML checkpoint checks the contents of individual XML data files or XML documents that are part of your Web application.
8.A database checkpoint checks the contents of databases accessed by your web site

26. Question – What are the types of Object Repositorys in QTP?

A.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.

27. Question – How QTP recognizes Objects in AUT?

A. QuickTest stores the definitions for application objects in a file called the Object Repository. As you record your test, QuickTest will add an entry for each item you interact with. Each Object Repository entry will be identified by a logical name (determined automatically by QuickTest), and will contain a set of properties (type, name, etc) that uniquely identify each object.Each line in the QuickTest script will contain a reference to the object that you interacted with, a call to the appropriate method (set, click, check) and any parameters for that method (such as the value for a call to the set method). The references to objects in the script will all be identified by the logical name, rather than any physical, descriptive properties.

28. Question – Explain the QTP Tool interface?

A.QTP Tool interface contains the following key elements:

1.Title bar:displaying the name of the currently open test
2.Menu bar:displ.aying menus of QuickTest commands
3.File toolbar:containing buttons to assist you in managing tests
4.Test toolbar:containing buttons used while creating and maintaining tests
5.Debug toolbar:containing buttons used while debugging tests.
6.Action toolbar:containing buttons and a list of actions, enabling you to view the details of an individual action or the entire test flow.
7.Test pane:containing two tabs to view your test-the Tree View and the Expert View
8.Test Details pane:containing the Active Screen
9.Data Table:containing two tabs, Global and Action, to assist you in parameterizing your test
10.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.)
11.Status bar:displaying the status of the test. The Action toolbar is not displayed when you open QuickTest 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.

29. Question – which environments does QTP supports?

A.QuickTest Professional supports functional testing of all enterprise environments, including Windows, Web, .NET, Java/J2EE, SAP,Siebel, Oracle, PeopleSoft, Visual Basic, ActiveX, mainframe terminal emulators, and Web services.

30. Question – Explain about the Test Fusion Report of QTP?

A.Once a tester has run a test, a TestFusion report displays allaspects of the test run: a high-level results overview, an expandableTree View of the test specifying exactly where application failuresoccurred, the test data used, application screen shots for every stepthat highlight any discrepancies, and detailed explanations of eachcheckpoint pass and failure. By combining TestFusion reports withQuickTest Professional, you can share reports across an entire QAand development team.

31. Question – What is keyword view and Expert view in QTP?

A.QuickTest’s Keyword Driven approach, test automation expertshave full access to the underlying test and object properties, via anintegrated scripting and debugging environment that is round-tripsynchronized with the Keyword View.Advanced testers can view and edit their tests in the Expert View,which reveals the underlying industry-standard VBScript thatQuickTest Professional automatically generates. Any changesmade in the Expert View are automatically synchronized with theKeyword View.

32. Question – How Does Run time data (Parameterization) is handled in QTP?

A. You can then enter test data into the Data Table, an integratedspreadsheet with the full functionality of Excel, to manipulate datasets and create multiple test iterations, without programming, toexpand test case coverage. Data can be typed in or imported fromdatabases, spreadsheets, or text files.

33. Question – What is QTPro? What is Quick Test Pro? What is Quick Test Professional?

A. Mercury QuickTest  provides the industry’s best solution for functional test and regression test automation – addressing every major software application and environment. This next-generation automated testing solution deploys the concept of Keyword-driven testing to radically simplify test creation and maintenance. Unique to QuickTest Professional’s Keyword-driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View.QuickTest Professional satisfies the needs of both technical and non-technical users. It enables you to deploy higher-quality applications faster, cheaper, and with less risk. To bring non-technical subject matter experts into the quality process in a meaningful way. Plus, it empowers the entire testing team to create sophisticated test suites with minimal training.The deployment of Mercury QuickTest Professional is optimized through the use of Mercury best practices. Mercury best practices cover all aspects of deployment, including product installation and operation, organizational design, process implementation, continual process improvement and measurement of return on investment (ROI). Throughout your implementation Mercury applies these best practices to your specific situation, creating world-class procedures for you that drive long-term success.

34. Question -Can you write a script to check if the folder exists or not?

A. Set fso = CreateObject(“Scripting.FileSystemObject”)

Set fldrext = fso.FolderExists(“c:\qtp”)

‘If fldrext contains 1 than folder named qtp is exist.

35. Question –How Does Run time data (Parameterization) is handled in QTP?

A- 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.

36. Question –What is keyword view and Expert view in QTP?

A- Quick Test Keyword Driven approach, test automation experts have full access to the underlying test and object properties, via an integrated scripting and debugging environment that is round-trip synchronized with the Keyword View. Advanced testers can view and edit their tests in the Expert View, which reveals the underlying industry-standard VBScript that Quick Test Professional automatically generates. Any changes made in the Expert View are automatically synchronized with the Keyword View.

37. Question –What is the Syntax to call one script from another? And what can be the Syntax to call one “Action” in another?

A-RunAction ActionName[IterationMode , IterationRange , Parameters]

Here the action becomes reusable on making this call to any Action.

IterationRange String is  Not mandatory . Indicates the rows for which action iterations will be performed. Valid only when the IterationMode is rngIterations. Enter the row range (i.e. “1-7”), or enter rngAll to run iterations on all rows.

If the action called by the RunAction statement includes an ExitAction statement, the RunAction statement can return the value of the ExitAction’s RetVal argument.

38. Question –How to export QTP results to an “.xls” file?

A- By default it creates an “XML” file and displays the results

39. Question – How the exception handling can be done using QTP?

A-It can be done by using the Recovery Scenario Manager which provides a wizard that guides you through the process of defining a recovery scenario.The wizard could be accessed in QTP> Tools-> Recovery Scenario Manager

40. Question –How many types of Actions are there in QTP?

A- There are three kinds of actions:

1) Non-reusable action: an action that can be called only in the test with which it is stored, and can be called only once.

2) 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.

3) 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.

41. Question –How do we analyze the Checkpoint results?

A -By adding standard checkpoints to your tests or components, you can compare the expected values of object properties to the object’s current values during a run session. If the results do not match, the checkpoint fails.

42. Question –How do we handle Run-time errors?

A- On Error Resume Next: causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the “On Error Resume Next” statement.

This allows execution to continue despite a run-time error.

You can then build the error-handling routine inline within the procedure.

Using “Err” object msgbox “Error no: ” & ” ” & Err.Number & ” ” & Err.description & ” ” & Err.Source & Err.HelpContext

43. Question –What are the different scripting languages you could use when working with QTP ?

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

44. Question –How to handle dynamic objects in QTP?

A-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 this out – If QTP 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 QTP 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 QTP 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.

45. Question –Explain the keyword createobject with an example?

A-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.

46. Question –What is a Run-Time Data Table? Where can I find and view this table?

A- * In QTP, there is data table that is at runtime.

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

* This is an excel file, which is stored in the folder of the test created, its name is Default.xls by default.
 47. Question –How to use SetROProperty?

A- Note: There is no such proprty in qtp. We have GetROProperty and SetTOProperty but not SetROProperty.

48. Question -What are different types of Action?

A-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.

49. Question – What is Recovery Scenario?

A-In order to handle unexpected event we are using Recovery Scenario.

For ex. : 1.

Printer out of paper

Different types of Recovery Scenario : 1. Pop Up Window 2. Object State 3. Test Run Error 4. Application Crash.

How to Use : First We are deciding the Trigger Point, then we are choosing the Recovery Operation and then we are choosing the Post Recovery Operations

50. Question – There is a excel file of 1 to 100 sheets how you will iterate through it?

A- Set xl=CReateobject(“excel.application”)

set workbook=xl.workbooks(“path of xls file”)

For i=0 to 100

Set worsheet=workbook.open(i)

‘do other related things

Next