QuickTest Professional (QTP) Interview Preparation Guide
Download PDF

QTP Interview Questions and Answers will guide us now that QuickTest Professional (QTP) is an automated functional Graphical User Interface (GUI) testing tool created by the HP subsidiary Mercury Interactive that allows the automation of user actions on a web or client based and desktop computer application. So learn QTP or get preparation for the job of QTP by the help of this QuickTest Professional (QTP) Interview Questions with Answers guide

115 QTP Questions and Answers:

Table of Contents:

QTP Interview Questions and Answers
QTP Interview Questions and Answers

1 :: How to make arguments optional in a function?

this is not possible as default VBS doesn't support this. Instead you can pass a blank scring and have a default value if arguments r not required.

2 :: How to verify the Cursor focus of a certain field?

Use "focus" property of "GetRoProperty" method"

3 :: Any limitation to XML Checkpoints?

Mercury has determined that 1.4MB is the maximum size of a XML file that QTP 6.5 can handle

4 :: How to add a runtime parameter to a datasheet?

DataTable.LocalSheet
The following example uses the LocalSheet property to return the local sheet of the run-time Data Table in order to add a parameter (column) to it.
MyParam=DataTable.LocalSheet.AddParameter("Time", "5:45")

6 :: How to open any application during Scripting?

SystemUtil , object used to open and close applications and processes during a run session.
(a) A SystemUtil.Run statement is automatically added to your test when you run an application from the Start menu or the Run dialog box while recording a test
E.g : SystemUtil.Run "Notepad.exe" SystemUtil.CloseDescendentProcesses ( Closes all the processes opened by QTP )

7 :: How to covert a String to an integer?

CInt()---> a conversion function available.

8 :: Explain the terms TEST and Business Component?

Test—A collection of steps organized into one or more actions, which are used to verify that your application performs as expected. By default each test begins with a single action. Business Component—A collection of steps representing a single task in your application. Business components (also known as components) are combined into specific scenarios to build business process tests in Mercury Quality Center with Business Process Testing. A component does not contain actions, you add steps directly to a componenet.

9 :: What do you mean by iteration?

Each run session that uses a different set of parameterized data is called an iteration.

11 :: How many Add-ins comes by default with QuickTest Professional (QTP)?

There are 3 Add-ins comes with QTP:
(1) ActiveX
(2) Visual Basic
(3) Web

12 :: What is output value?

An output value is a value retrieved during the run session and entered into your Data Table or saved as a variable or a parameter. Each run session that uses a different set of parameterized data is called an iteration.

13 :: How many tabs are available in Debug Viewer Pane?

The Debug Viewer pane contains three tabs to assist you in debugging your test or component—Watch Expressions, Variables, and Command. Watch Expressions The Watch Expressions tab enables you to view the current value of any variable or other VBScript expression. Variables The Variables tab enables you to view the current value of all variables that have been recognized up to the last step performed in the run session. Command The Command tab enables you to execute a line of script in order to set or modify the current value of a variable or VBScript object in your test or component. When you continue the run session, QuickTest uses the new value that was set in the command.

14 :: What is Active Screen?

The Active Screen provides a snapshot of your application as it appeared when you performed a certain step during a recording session.

15 :: Explain different recording modes?

QuickTest’s normal recording mode records the objects in your application and the operations performed on them. This mode is the default and takes full advantage of QuickTest’s test object model, recognizing the objects in your application regardless of their location on the screen. Analog Recording - enables you to record the exact mouse and keyboard operations you perform in relation to either the screen or the application window. In this recording mode, QuickTest records and tracks every movement of the mouse as you drag the mouse around a screen or window. This mode is useful for recording operations that cannot be recorded at the level of an object, for example, recording a signature produced by dragging the mouse. Note: You cannot edit analog recording steps from within QuickTest. ? Low-Level Recording - enables you to record on any object in your application, whether or not QuickTest recognizes the specific object or the specific operation. This mode records at the object level and records all run-time objects as Window or WinObject test objects. Use low-level recording for recording tests in an environment or on an object not recognized by QuickTest. You can also use low-level recording if the exact coordinates of the object are important for your test. Note: Steps recorded using low-level mode may not run correctly on all objects.

16 :: Explain different types of checkpoints?

There are 10 types of checkpoints you can insert: Standard Checkpoint checks the property value of an object in your application or Web page. The standard checkpoint checks a variety of objects such as buttons, radio buttons, combo boxes, lists, etc. Image Checkpoint checks the value of an image in your application or Web page. For example, you can check that a selected image’s source file is correct. Bitmap Checkpoint checks an area of your Web page or application as a bitmap. Table Checkpoint checks information within a table. For example, suppose your application or Web site contains a table listing all available flights from New York to San Francisco. You can add a table checkpoint to check that the time of the first flight in the table is correct. Text Checkpoint checks that a text string is displayed in the appropriate place in your application or on a Web page. Text Area Checkpoint checks that a text string is displayed within a defined area in a Windows application, according to specified criteria. Accessibility Checkpoint identifies areas of your Web site that may not conform to the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines. Page Checkpoint checks the characteristics of a Web page. For example, you can check how long a Web page takes to load or whether a Web page contains broken links. Database Checkpoint checks the contents of a database accessed by your application. XML Checkpoint checks the data content of XML documents in XML files or XML documents in Web pages and frames.

17 :: How many types of parameters are there?

There are four types of parameters: 1. Test, action or component parameters 2. Data Table parameters 3. Environment variable parameters 4. Random number 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.0 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, QuickTest 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 QuickTest 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.

18 :: What is parameter in QTP?

A parameter is a variable that is assigned a value from an external data source or generator. If you wish to parameterize the same value in several steps in your test or component, you may want to consider using the Data Driver rather than adding parameters manually.

19 :: When and Why to use Descriptive programming?

Below are some of the situations when Descriptive Programming can be considered useful:
The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <<UserName>>”.
When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object.
When you don’t want to use object repository at all. Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository

Scenario 1: Suppose we have a web application that has not been developed yet. Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing

20 :: How to use Descriptive programming?

There are two ways in which descriptive programming can be used
By creating properties collection object for the description.
By giving the description in form of the string arguments.

By creating properties collection object for the description.

To use this method you need first to create an empty description

Dim obj_Desc ‘Not necessary to declare
Set obj_Desc = Description.Create

Now we have a blank description in “obj_Desc”. Each description has 3 properties “Name”, “Value” and “Regular Expression”.

obj_Desc(“html tag”).value= “INPUT”

21 :: When should I use SMART Identification?

SMART Identification
Smart Identification is nothing but an algorithm used by QTP when it is not able to recognize one of the object. A very generic example as per the QTP manual would be, A photograph of a 8 year old girl and boy and QTP records identification properties of that girl when she was 8, now when both are 10 years old then QTP would not be able to recognize the girl. But there is something that is still the same, that is there is only one girl in the photograph. So it kind of PI (Programmed intelligence) not AI.

When should I use SMART Identification? Something that people don't think about too much. But the thing is that you should disable SI while creating your test cases. So that you are able to recognize the objects that are dynamic or inconsistent in their properties. When the script has been created, the SI should be enabled,so that the script does not fail in case of small changes. But the developer of the script should always check for the test results to verify if the SI feature was used to identify a object or not. Sometimes SI needs to be disabled for particular objects in the OR, this is advisable when you use

22 :: What is a Recovery Scenario?

Recovery scenario gives you an option to take some action for recovering from a fatal error in the test. The error could range in from occasional to typical errors. Occasional error would be like "Out of paper" popup error while printing something and typical errors would be like "object is disabled" or "object not found". A test case have more then one scenario associated with it and also have the priority or order in which it should be checked.

23 :: Can I change properties of a test object?

Yes. You can use SetTOProperty to change the test object properties. It is recommended that you switch off the Smart Identification for the object on which you use SetTOProperty function.

24 :: Where to use function or action?

Well answer depends on the scenario. If you want to use the OR feature then you have to go for Action only. If the functionality is not about any automation script i.e. a function like getting a string between to specific characters, now this is something not specific to QTP and can be done on pure VB Script, so this should be done in a function and not an action. Code specific to QTP can also be put into an function using DP. Decision of using function/action depends on what any one would be comfortable using in a given situation.

25 :: What is checkpoint in QTP?

Checkpoint is basically a point in the test which validates for truthfulness of a specific things in the AUT. There are different types of checkpoints depending on the type of data that needs to be tested in the AUT. It can be text, image/bitmap, attributes, XML etc....