Vous êtes sur la page 1sur 76

Q. 1: What is Automation Object Model in QTP?

Like we use QTP for automating the testing of our applications, we can use the automation object model
of QTP to automate its own operations as well. With the help of objects, methods, and properties exposed
by the automation object model of QTP along with standard programming elements like loops and
conditional statements, we can write programs which can configure QTP options and run tests or
components instead of performing these operations manually using the QTP interface. Automation
programs are useful for performing the same tasks several times or on multiple tests or components, or
quickly configuring QTP according to the needs for a particular environment or application. Most of the
dialog boxes in QTP have a corresponding automation object. Most of the options in dialog boxes can be
set retrieved using the corresponding object property, and most of the menu commands and other
operations have corresponding automation methods.
<<<<<< =================== >>>>>>
Q. 2: What is a Recovery Scenario?
Recovery scenario gives us an option to take some action for recovering from a fatal error in the test.
Such problems are quite frequent especially when the tests are made to run unattended. In such a case
the test process halts until the user perform some desired recovery operation. Recovery scenarios are
useful when it is difficult to predict at which step the errors can come or when we are confident that the
error will not come in the QTP script, whereas it can be anywhere outside the QTP Script. For illustration;
Pop-up message of out of paper, as caused by the printer device driver. On error resume next is
preferred when we are sure that the error is expected one and wish to perform some other actions.
<<<<<< =================== >>>>>>
Q. 3: What is Smart Identification in QTP?
QTP has a unique feature by the name Smart Object Identification or recognition which is used for
identifying the objects smartly, whenever the normal identification fails due to the dynamic changes in the
properties of the objects. Smart Identification is nothing but an algorithm used by the QTP when it is not
able to recognize an object.
<<<<<< =================== >>>>>>
Q. 4: How QTP identifies various Objects?
During recording QTP identifies various objects and stores them as test objects. For each test object QTP
learns a set of default properties called mandatory properties. Simultaneously QTP looks at rest of the
objects to check whether these properties are sufficient to uniquely identify the object or not. During the
test run, QTP searches for the run time objects, which match with the test objects which, have been
captured by it during recording.
<<<<<< =================== >>>>>>
Q. 5: What are Object Repositories in QTP?
When planning and creation of tests is done, we firstly consider how we would like to store the objects in
our tests. In QTP, the test objects can be stored in two types of object repositories
a) Shared Object Repository: It stores test objects in a file that can be accessed by multiple tests. If
someone is new to QTP, he can prefer to use local object repositories. This way he can record and run
the tests without creating, choosing, or modifying shared object repositories because all objects are
automatically getting saved in a local object repository which can be accessed by its corresponding
action.
b) Local Object Repository: It stores objects in a file that is associated with one specific action, so that
only that action can access the stored objects. If someone is familiar with QTP testing, he can find that it
is quite efficient to save the objects in a shared object repository. This way, he can use the same shared
object repository for multiple actions if the actions include the same objects. Test object information that
applies to many actions is kept in one centralized location. When the objects in the application change,
we can update them in one location for all the actions that use this shared object repository.
<<<<<< =================== >>>>>>
Q. 6: How QTP recognizes objects in Object Repositories?
Object Repository displays a tree of all the objects in the current component or in the current action or in
the entire test, depending on the object repository mode selected by the user. We can view or modify the
test object description of any test object in the repository or to add new objects to the repository. QTP
remembers the default property values and determines in which test object class it fits. If it is not found
enough it automatically adds assistive properties, one by one to the description until it successfully

compiles the unique description. If no assistive properties are available, then it adds a special Ordinal
identifier such as object location on the page or in the source code.
<<<<<< =================== >>>>>>
Q. 7: How many types of Actions are there in QTP?
QTP uses three kinds of actions like: a) Non-reusable Action: Can be called only in the test with which it
is stored, and can be called only once. b) Reusable Action: Can be called multiple times by the test with
which it is stored as well as by other tests .c) External Action: Is a reusable action which is stored with
another test. External actions are read-only in the calling test, but we can choose to use a local, editable
copy of the Data Table information for the external action. By default, all new actions are non-reusable.
We can mark every action created by us in the test as reusable or non-reusable.
<<<<<< =================== >>>>>>
Q. 8: Is there any built-in function for Scripting in QTP?
QTP uses an in-built functionality called Step Generator to create scripts while appropriate steps are
entered into it. Step Generator utility enables us to add steps by selecting from a range of contextsensitive options and entering the required values. We can open the Step Generator from the Keyword
View or Expert View while recording or editing our test. We can also open the Step Generator from the
Active Screen while editing. Method to open the Step Generator from a function library is as under:
In the function library, click the location in which we want to insert the new
Choose Insert > Step Generator, or right-click and choose Step Generator.
Alternatively, press F7.
<<<<<< =================== >>>>>>
Q. 9: What is a Run-Time Data Table in QTP?
During the run session, QTP creates a Runtime Data Table, which is live version of the Data Table
associated with our test. During the run session, QTP displays the run-time data in the Data Table pane
so that we can see the changes taking place in the Data Table. When the run session ends, the Runtime
Data Table closes, and the Data Table pane again displays the stored design-time Data Table. Data
entered in the run-time Data Table during the run session does not get saved along with the test. The
final data from the run-time Data Table gets displayed in the Run-Time Data Table in the Test Results
window. Runtime Data Table is an excel file, which gets stored in the folder of the test created, its name
is Default.xls by default.
<<<<<< =================== >>>>>>
Q. 10: What is the Object Spy feature in QTP?
Using the Object Spy pointing hand mechanism, we can view the supported properties and methods of
any object in an open application. As we move the pointing hand over the objects in the application, their
details are displayed in the Object Spy. These details may include the test objects hierarchy tree, its
properties and values, and the methods associated with the object. For methods, the syntax is also
displayed.
<<<<<< =================== >>>>>>
Q. 11: What is a Virtual Object in QTP?
Since sometimes complex objects are not recognized & recorded properly by QTP. Hence an
experienced user can define that object as a personal virtual object and build a virtual object repository.
This way by the concept of Virtual Object, the user can add some sort of support for such complex
objects. If it is possible to extract the desired information from the object, we can do successful record
and playback against that object.
<<<<<< =================== >>>>>>
Q. 12: How results are generated in QTP?
At the end of the test, QTP generates a result file for the test cases, which is in the form of a XML tree.
This results file provides detail regarding Pass or Fail counts, error messages, and all supporting
information which allows the user to diagnose the main cause of a failure.
<<<<<< =================== >>>>>>
Q. 13: How many types of main views of a script are available in QTP?
QTP provides two main views of a script.
1) Keyword View: It is the default test procedure interface of QTP & is most useful for the beginners. It
displays the automation steps of a test procedure as a descriptive tree of Actions and functions. The tree
contains columns listing the Action or function name, any parameters, and comments.

2) Expert View: It is most suitable for the advanced users, enabling them to customize the test, like writing
user-defined functions. It is meant for displaying and editing of the source code of the test. Except for the
root Global action, all other test actions can be edited here. Expert View acts as an IDE for the test. It
includes most standard IDE features, such as breakpoints.
<<<<<< =================== >>>>>>
Q. 14: What is a Checkpoint?
In QTP, Checkpoint is used to verify the application under test. It can introduce a checkpoint to verify as
to whether a particular object, text or a bitmap is present in the automation run. During a test execution, a
checkpoint verifies that the behavior or state of the actual application is consistent with the expected
application or not.
<<<<<< =================== >>>>>>
Q. 15: How many types of Checkpoints are available in QTP
1) Standard Checkpoint for checking the properties of an object.
2) Table Checkpoint for checking the properties of a table.
3) Image Checkpoint for checking the properties of an image.
4) Bitmap Checkpoint for comparing an area of the application under test pixel-by-pixel with the screen
as seen at record-time.
5) Database Checkpoint for automating the back-end testing.
6) Text Checkpoint for checking that a section of text is found between two other sections of text.
7) Text Area Checkpoint
8) Page Checkpoint for checking the properties of a web page.
9) Accessibility Checkpoint for checking the accessibility of an application.
10) XML Checkpoint
<<<<<< =================== >>>>>>
Q. 16: What is the use of Text Output Value in QTP?
Text Output values enable us to view the values which are taken by the application during the run time. If
parameterized, the values change for every iteration. Hence by creating output values, we can capture
the values which are taken by the application during the runtime and output them to the data table.
<<<<<< =================== >>>>>>
Q. 17: Whats the difference between a Checkpoint and Output Value?
Checkpoint only checks for the specific attribute of an object in AUT while Output value can output those
attributes value to a column in a data table.
<<<<<< =================== >>>>>>
Q. 18: How can we disable Smart Identification during the Run Session?
Selection of the option Disable Smart Identification during the run session , Instructs QTP not to use the
Smart Identification mechanism during the run session. When we select this option, the Enable Smart
Identification check boxes in the Object Properties and Object Repository dialog boxes get disabled,
although the settings are saved. However when we clear this option, the Enable Smart Identification
check boxes return to their previous on or off setting.
<<<<<< =================== >>>>>>
Q. 19: What are the Properties used by Smart Identification Feature of QTP?
1) Base Filter Properties: Are the most fundamental properties of a particular test object class. Here we
cannot change their values without changing the essence of the original object. 2) Optional Filter
Properties: Are other properties, which help us in identifying the objects of a particular class since these
are not likely to get changed frequently. These properties can be ignored in case these are not applicable
any more.
<<<<<< =================== >>>>>>
Q. 20: How can we check if an environment variable exists or not?
When we use Environment(Param1).value then QTP expects the environment variable to be already
defined. But when we use Environment.value(Param1) then QTP will create a new internal environment
variable if it does not exists already. So to be sure that variable exist in the environment try using
Environment(Param1).value.
<<<<<< =================== >>>>>>
21: Where can we use a Function or an Action?
It all depends on the scenario. If we want to use the OR feature then we 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.
<<<<<< =================== >>>>>>
Q. 22: What is the difference between an Action and a Function?
Action is a activity specific to QTP while functions are a generic thing which is a feature of VB Scripting.
Action can have a object repository associated with it while a function cant. A function is just lines of code
with some / none parameters and a single return value while an action can have more than one output
parameters.
<<<<<< =================== >>>>>>
Q. 23: What are the various events available in the Recovery Scenario Manager?
1) Application Crash: This event is useful in handling crashed applications at runtime.
2) Pop-Up Window: This event is useful in managing various unwanted application windows, which get
built-up at runtime.
3) Test Run Error: This event is useful in handling VBScript statement errors at runtime.
4) Object State: This event is useful in handling object related errors at runtime.
<<<<<< =================== >>>>>>
Q. 24: What are the Elements of Recovery Scenario?
Steps to handle the exceptions are
1) Trigger Event: Is an unexpected event like appearance of a Pop-up window, object state, test run error
causing application crash or interruption in our running session.
2) Recovery Steps: Constitutes a series of steps required to be performed to enable QTP to proceed
further with the process of test after some trigger event has interrupted the run session. Examples of a
recovery operation can be 1) A keyboard or mouse Operation like a Click over the OK button in the Popup window 2) Close Application Process 3) Function Call 4) Restarting the OS etc.
3) Post-Recovery Test Run: Are a set of instructions designed to be provided to QTP on proceeding
further with the test after some recovery operation has been carried out. Examples of Post Recovery
actions can be repeating the complete test from the beginning or some steps may be skipped altogether
& continuing with the remaining steps in the test.
<<<<<< =================== >>>>>>
Q. 25: When to use a Recovery Scenario and When to use on error resume next?
Recovery scenarios are useful when it is difficult to predict at which step the errors can come or when we
are confident that the error will not come in the QTP script, whereas it can be anywhere outside the QTP
Script.
For illustration; Pop-up message of out of paper, as caused by the printer device driver. On error
resume next is preferred when we are sure that the error is expected one and wish to perform some
other actions.
<<<<<< =================== >>>>>>
Q. 26: What are the key features of QTP at a glance?
# Ease of Use: QTP allows even novice testers to become productive in minutes. We can create a test
script by simply pressing a Record button and using an application to perform a typical business process.
Each step in the business process is automated documented with a plain-English sentence and screen
shot. Users can easily modify, remove, or rearrange test steps in the Keyword View.
# Simple Interface: QTP is much simpler to understand. It presents a test case as a simple business
workflow to the tester.
# Simple Language: QTP uses Microsofts VBScript for its test procedures, and to manipulate the objects
and controls of the application under test. VBScript is a real programming language where several
existing functions & resources are easily available for implementation these days.
# Use of Zero-Configuration Technology: QTP uses next-generation zero-configuration Keyword Driven
testing technology. This helps in faster test creation, easier maintenance, and provides more powerful
data-driving capability.

# Automatic Insertion of Checkpoints: QTP enables thorough validation of applications through a full
complement of checkpoints. QTP can automatically introduce checkpoints to verify application properties
and functionality, for example to validate output or check link validity.
# Marvelous Interface with Data-tables: QTP allows entry of 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. QTP has better and easier to use Data table integration compared to
WinRunner.
# Better Object Identification Mechanism: QTP Identifies objects with Unique Smart Object Recognition,
even if objects change from build to build, thereby enabling reliable unattended script execution.
# Support of Variety of Environment: QTP supports functional testing of all popular environments, like
Windows, Web, .Net, Visual Basic, ActiveX, Java, SAP, Siebel, Oracle, PeopleSoft, terminal emulators,
and Web services.
# Easy Adaptability of Microsoft Object Models: QTP can easily create and implement Microsoft Object
Model like: Outlook objects, ADO objects, FileSystem objects, supports DOM, WSH, etc.
# Auto-Documentation Technology: QTP renders test documentation and test creation to a single step
with the help of its auto-documentation technology
<<<<<< =================== >>>>>>
Q. 27: What are various types of properties when using Object Identification in QTP?
QTP uses three types of properties when identifying an object
1. Mandatory Properties: Always learn these properties for the object
2. Assistive Properties: Learn in case Mandatory properties are not enough to identify the object uniquely
3. Ordinal Identifiers: Learn in case both mandatory and assistive properties are not able to recognize the
objects correctly
<<<<<< =================== >>>>>>
Q. 28: What are the various ways to insert a Action in a test in QTP?
There are three ways to insert an Action in a test
1. Insert Call to New
2. Insert Call to Copy
3. Insert Call to Existing
<<<<<< =================== >>>>>>
Q. 29: What is the use of Parameterization in QTP?
Parameterization is helpful in aspects like:
# Parameterization allows us to pick different values at run time.
# Reduces Time and Effort.
# Usage of data drivers allows us to use the same data for various input boxes.
# Parameterization can also be done for checkpoints.
<<<<<< =================== >>>>>>
Q. 30: What are Data Tables in QTP?
Data Table is MS Excel like spreadsheet which can be used for parameterizing a test case
DataTable are of two types like:
1. Global Data Table: Is a Data table for Test flow
2. Local Data Table: Is a Data table for every action
<<<<<< =================== >>>>>>
Q. 31: What are the Environment Variables?
Environment variables are global variables available to all Actions
# They can be used to run a test case on different environment
# To add a new Environment variable go to Test -> Settings->Environment (Tab)
# Environment variables are of two types like:
1. Built in Environment Variables: These provide information about the system and the current test
2. User-Defined Environment Variables: These are added in the Environment tab of Test Settings. These
are Read-only during the test run
<<<<<< =================== >>>>>>
Q. 32: How many types of Parameters are there in QTP?
There are two types of parameters like:
1) Test parameters:

# These can be set in Test->Settings->Parameters (Tab)


# Test parameters value can be provided when replaying the test
# Test arguments can be accessed in the test using TestArgs()
2) Action parameters :
# Used to pass parameters to Action
# Output parameters can only be used when Action is being called for a single iteration
# Ex RunAction Login, oneIteration, TestUser, TestPass, out
# A parameter can be accessed using Parameter(ParamName)
<<<<<< =================== >>>>>>
Q. 33: What is Descriptive Programming?
Descriptive Programming is an alternate way of writing test cases without having objects in object
repository
Descriptive programming can be done in two ways
1. Using Object Description
2. Using String Description
In Descriptive Programming objects are identified by describing all the identification properties
<<<<<< =================== >>>>>>
Q. 34: After creating the test, what is the purpose of running them?
1) To Check the Application: The test starts running from the first line in our test and stops at the end of
the test. While running, QTP connects to our application and performs each operation in our test,
including any checkpoints, such as checking any text strings, objects, tables, and so forth. If we had
parameterized our test with Data Table parameters, QTP repeats the test (or specific actions in your test)
for each set of data values we had defined.
2) To Debug the Application: We can control our run session to help us identify and eliminate defects in
our test. We can use the Step Into, Step Over, and Step Out commands to run our test step by step. We
can begin our run session from a specific step in our test, or run the test until a specific step is reached.
We can also set breakpoints to pause our test at predetermined points. We can view the value of
variables in our test each time it stops at a breakpoint in the Debug Viewer.
3) To Update the Application: We can run our test using Update Run Mode to update the property sets
used for test object descriptions, the expected checkpoint values, the data available to retrieve in output
values, and the Active Screen images and values.
We can run our test using Maintenance Run Mode when we know that our application has changed, and
we therefore expect that QTP will not be able to identify the objects in our test. When we run tests in
Maintenance Run Mode, a wizard opens for steps that fail because an object could not be found in the
application. The wizard then guides us through the steps of resolving the issue, and, after we resolve the
issue, the run continues.
<<<<<< =================== >>>>>>
Q. 35: What are the main stages of Testing with QTP?
Testing with QTP involves main stages like:
Planning
Creating Tests
Running Tests
Analyzing Results
<<<<<< =================== >>>>>>
Q. 36 : How can we do the Analysis of Results in QTP?
After we run our test, we can view the results.
# View the results in the Test Results window: After we run our test, we can view the results of the run in
the Test Results window. We can view a summary of our results as well as a detailed report. If we had
captured still images or movies of our application during the run, we can view these from the Test Results
window.
# Report defects detected during a run session: If we have access to Quality Center, the HP centralized
quality solution, we can report the defects we discover to the project database. We can instruct QTP to
automatically report each failed step in our test, or we can report them manually from the Test Results
window.
<<<<<< =================== >>>>>>
Q. 37: What is Business Process Testing?

# Business Process Testing is a role-based testing model that enables Subject Matter Expertswho
understand the various parts of the application being testedto create business process tests in Quality
Center. Automation Engineerswho are experts in QTP and automated testinguse QTP to define all of
the resources and settings required to create business process tests.
# Business Process Testing uses a keyword-driven methodology for testing, based on the creation and
implementation of business components and business process tests. A business component is an easilymaintained, reusable unit comprising one or more steps that perform a specific task within an application.
<<<<<< =================== >>>>>>
Q. 38: What are Permissions Required to Run QTP?
Following file system permissions are required:
1) Full read and write permissions for all the files and folders under the folder in which QTP is installed
2) Full read and write permissions to the Temp folder
3) Read permissions to the Windows folder and to the System folder
We must have the following registry key permissions:
1) Full read and write permissions to all the keys under
HKEY_CURRENT_USER\Software\Mercury Interactive
2) Read and Query Value permissions to all the HKEY_LOCAL_MACHINE and HKEY_CLASSES_ROOT
keys
<<<<<< =================== >>>>>>
Q. 39: What is the role of Keyword View in QTP?
The Keyword View enables us to create and view the steps of our test in a keyword-driven, modular, table
format. The Keyword View is comprised of a table-like view, in which each step is a separate row in the
table, and each column represents different parts of the steps. We can modify the columns displayed to
suit our requirements. We create and modify tests by selecting items and operations in the Keyword View
and entering information as required. Each step is automatically documented as we complete it, enabling
us to view a description of our test steps in understandable English. Each operation performed on our
application during a recording session is recorded as a row in the Keyword View.
<<<<<< =================== >>>>>>
Q. 40: What is the role of Expert View in QTP?
In the Expert View, QTP displays each operation performed on our application in the form of a script,
comprised of VBScript statements. The Expert View is a script editor with many script editing capabilities.
For each object and method in an Expert View statement, a corresponding row exists in the Keyword
View.
<<<<<< =================== >>>>>>
Q. 41: What are the various utilities and tools available in QTP?
Tools Menu contains the following utilities and tools which are helpful in the testing process:
# Action Conversion Tool: Enables us to convert test actions that were created using QTP to scripted
components for use in business process testing.
# Additional Installation Requirements: Opens the Additional Installation Requirements dialog box, which
displays any prerequisite software that we must install or configure to work with QTP.
# Business Component Upgrade Tool: Opens the Business Component Upgrade Tool. If we are
connected to a Quality Center project, this tool enables us to upgrade all of the business components in a
Quality Center project, from an earlier component version to the format required by the current version.
# HP Micro Player: Opens the HP Micro Player, which enables us to view captured movies of a run
session without opening Quick Test.
# License Validation Utility: Opens the License Validation utility, which enables us to retrieve and validate
license information.
# Password Encoder: Opens the Password Encoder dialog box, which enables us to encode passwords.
We can use the resulting strings as method arguments or Data Table parameter values (tests only).
# QTP Script Editor: Opens the QTP Script Editor, which enables us to open and modify the scripts of
multiple tests and function libraries, simultaneously.
# Register New Browser Control: Opens the Register Browser Control Utility, which enables us to register
our browser control application so that QTP recognizes our Web object when recording or running tests.
# Remote Agent: Activates the QuickTest Remote Agent, which enables us to configure how QTP
behaves when a test is run by a remote application such as Quality Center.

# Save and Restore Settings: Opens the Save and Restore Settings dialog box, which enables us to save
our existing configurations before uninstalling an old version, and then restore them after installing a new
version.
# Silent Test Runner: Opens the Silent Test Runner dialog box, which enables us to run a QTP test the
way it is run from LoadRunner and Business Availability Center.
# Test Batch Runner: Opens the Test Batch Runner dialog box, which enables us to set up QTP to run
several tests in succession.
# Test Results Deletion Tool: Opens the Test Results Deletion Tool dialog box, which enables us to
delete unwanted or obsolete results from our system according to specific criteria that you define.
<<<<<< =================== >>>>>>
Q. 42: What is the concept of Test Object Model in QTP?
QTP tests our dynamically changing application by learning and identifying test objects and their
expected properties and values. To do this, QTP analyzes each object in our application in much the
same way that a person would look at a photograph and remember its details. The test object model is a
large set of object types or classes that QTP uses to represent the objects in our application. Each test
object class has a list of properties that can uniquely identify objects of that class and a set of relevant
methods that QuickTest can learn about it.
A test object is an object that QTP creates in the test to represent the actual object in your application.
QTP stores information on the object that will help it identify and check the object during the run session.
A run-time object is the actual object in our application on which methods are performed during the run
session.
<<<<<< =================== >>>>>>
Q. 43: Please explain some real world scenario explaining Object learning process of QTP?
QTP learns objects just as we would. For example, suppose as part of an experiment, Bob is told that he
will be shown a photograph of a picnic scene for a few seconds during which someone will point out one
item in the picture. Bob is told that he will be expected to identify that item again in identical or similar
pictures one week from today. Before he is shown the photograph, Bob begins preparing himself for the
test by thinking about which characteristics he wants to learn about the item that the tester indicates.
Obviously, he will automatically note whether it is a person, inanimate object, animal, or plant. Then, if it is
a person, he will try to commit to memory the gender, skin color, and age. If it is an animal, he will try to
remember the type of animal, its color, and so forth. The tester shows the scene to Bob and points out
one of three children sitting on a picnic blanket. Bob notes that it is a Caucasian girl about 8 years old. In
looking at the rest of the picture, however, he realizes that one of the other children in the picture could
also fit that description. In addition to learning his planned list of characteristics, he also notes that the girl
he is supposed to identify has long, brown hair. Now that only one person in the picture fits the
characteristics he learned, he is fairly sure that he will be able to identify the girl again, even if the scene
the tester shows him next week is slightly different. Since he still has a few moments left to look at the
picture, he attempts to notice other, more subtle differences between the child he is supposed to
remember and the others in the picturejust in case. If the two similar children in the picture appeared to
be identical twins, Bob might also take note of some less permanent feature of the child, such as the
childs position on the picnic blanket. That would enable him to identify the child if he were shown another
picture in which the children were sitting on the blanket in the same order.
<<<<<< =================== >>>>>>
Q. 44: What is the method used by QTP to learn objects?
QTP looks at the object being learned and stores it as a test object, determining in which test object
class it fits. In the same way, Bob immediately checked whether the item was a person, animal, plant, or
inanimate object. QTP might classify the test object as a standard Windows dialog box, a Web button, or
a Visual Basic scroll bar object, for example. Then , for each test object class, QTP has a list of
mandatory properties that it always learns; similar to the list of characteristics that Bob planned to learn
before seeing the picture. When QTP learns an object, it always learns these default property values, and
thenlooks at the rest of the objects on the page, dialog box, or other parent object to check whether this
description is enough to uniquely identify the object. If it is not, QTP adds assistive properties, one by
one, to the description, until it has compiled a unique description; similar to when Bob added the hair
length and color characteristics to his list. If no assistive properties are available, or if those available are
not sufficient to create a unique description, QTP adds a special ordinal identifier, such as the objects
location on the page or in the source code, to create a unique description.

<<<<<< =================== >>>>>>


Q. 45: What is Test Object Method in QTP?
It is a method that QTP recognizes as applicable to a particular test object. For example, the Click
method is applicable to a WebButton test object. As we add steps to our test, we specify which method to
perform on each test object. If we record steps, QTP records the relevant method as it is performed on an
object. During a run session, QTP performs the specified test object method on the run-time object. Runtime object methods are the methods of the object in our application as defined by the object creator. We
can access and perform run-time object methods using the Object property.
<<<<<< =================== >>>>>>
Q. 46: What are the Test Object Properties in QTP?
Test object properties are the properties whose values are captured from the objects in our application
when QTP learns the object. QTP uses the values of these properties to identify run-time objects in our
application during a run session. Property values of objects in our application may change dynamically
each time our application opens, or based on certain conditions. We may need to modify the test object
property values to match the run-time object property values. We can modify test object properties
manually while designing our test, or use SetTOProperty statements during a run session.
<<<<<< =================== >>>>>>
Q. 47: How to decide on whether to save the objects in Local or Shared Object Repositories?
Local object repository is easiest to use when we are creating simple tests, especially under the following
conditions:
# We have only one, or very few, tests that correspond to a given application, interface, or set of objects.
# We do not expect to frequently modify object properties.
# We generally create single-action tests.
Shared object repository is the preferred option when:
# We are creating tests using keyword-driven methodologies & not by recording.
# We have several tests that test elements of the same application, interface, or set of objects.
# We expect the object properties in our application to change from time to time and we regularly need to
update or modify object properties.
# We often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to
Action options.
<<<<<< =================== >>>>>>
Q. 48: What are the possibilities of Exporting the data among various Object Repositories?
When QTP learns a test object, it adds it to the local object repository & not to the shared object
repository unless the same test object already exists in an associated shared object repository. In this
case, QTP uses the existing information in the shared object repository. We can export objects from the
local object repository to a shared object repository. We can also export the local object repository and
replace it with a shared object repository. This enables us to make the local objects accessible to other
actions.
We can also merge objects from the local object repository directly to a shared object repository that is
associated with the same action. This can help reduce maintenance since we can maintain the objects in
a single shared location, instead of multiple locations.
<<<<<< =================== >>>>>>
Q. 49: What is the effect of restoring Default Properties for a Test Object in QTP?
When we restore the default properties, it restores the mandatory property set defined for the selected
object class in the Object Identification dialog box. Any changes that we have made to the description
property set for the test object will be overwritten. However, if property values were defined for any of the
mandatory properties they are not modified.
<<<<<< =================== >>>>>>
Q. 50: What is the use of Ordinal Identifiers in QTP?
An ordinal identifier assigns a numerical value to a test object that indicates its order or location relative to
other objects with an otherwise identical description for objects having the same values for all properties.
This ordered value provides a backup mechanism that enables QTP to create a unique description to
recognize an object when the defined properties are not sufficient to do so. We can specify the ordinal
identifier for test objects in the local object repository using the Object Repository window or Object
Properties dialog box, and for test objects in the shared object repository using the Object Repository
Manager.

Q. 51: What is the use of Mapping Repository Parameter Values in QTP?


We can map repository parameters that are used in shared object repositories that are associated with
our action. Mapping a repository parameter to a value or parameter specifies the property values used to
identify the test object during a run session. We can specify that the property value is taken from a
constant value, or parameterize it using a Data Table, random number, environment, or test parameter.
We can map each repository parameter as required in each test that has an associated object repository
containing repository parameters .If we do not map a repository parameter, the default value that was
defined with the parameter, if any, is used during the action run. If the parameter is unmapped, meaning
no default value was specified for it, the test run may fail if a test object cannot be identified because it
has an unmapped parameter value.
<<<<<< =================== >>>>>>
Q. 52: What are the various Object Properties in QTP?
QTP has a predefined set of properties that it learns for each test object. If these mandatory property
values are not sufficient to uniquely identify a learned object, QTP can add some assistive properties and
an ordinal identifier to create a unique description. Mandatory properties are properties that QTP always
learns for a particular test object class. Assistive properties are properties that QTP learns only if the
mandatory properties that QTP learns for a particular object in our application are not sufficient to create
a unique description. If several assistive properties are defined for an object class, then QTP learns one
assistive property at a time, and stops as soon as it creates a unique description for the object. If QTP
does learn assistive properties, those properties are added to the test object description.
<<<<<< =================== >>>>>>
Q. 53: What are the types of Ordinal Identifiers used by QTP to identify an object?
1) Index Property: It indicates the order in which the object appears in the application code relative to
other objects with an otherwise identical description.
2) Location Property:It indicates the order in which the object appears within the parent window, frame, or
dialog box relative to other objects with an otherwise identical description.
3) CreationTime Property: It is applicable for Browser Object only. It Indicates the order in which the
browser was opened relative to other open browsers with an otherwise identical description.
<<<<<< =================== >>>>>>
Q. 54: What is Index Property for Identifying the Objects in QTP?
While learning an object, QTP can assign a value to the test objects Index property to uniquely identify
the object. The value is based on the order in which the object appears within the source code. The first
occurrence is 0.
Index property values are object-specific. Therefore, if we use Index:=3 to describe a WebEdit test object,
QTP searches for the fourth WebEdit object in the page. However, if we use Index:=3 to describe a
WebElement object, QTPt searches for the fourth Web object on the page regardless of the type
because the WebElement object applies to all Web objects.
<<<<<< =================== >>>>>>
Q. 55: What is Location Property for Identifying the Objects in QTP?
While learning an object, QTP can assign a value to the test objects Location property to uniquely identify
the object. The value is based on the order in which the object appears within the window, frame, or
dialog box, in relation to other objects with identical properties. The first occurrence of the object is 0.
Values are assigned in columns from top to bottom, and left to right.
Location property values are object-specific. Therefore, if we use Location:=3 to describe a WinButton
test object, QTP searches from top to bottom, and left to right for the fourth WinButton object in the page.
However, if you use Location:=3 to describe a WinObject object, QTP searches from top to bottom, and
left to right for the fourth standard object on the page regardless of the type because the WinObject
object applies to all standard objects.
<<<<<< =================== >>>>>>

Q. 56: What is Creation Time Property for Identifying the Objects in QTP?
While learning a browser object, if QTP is unable to uniquely identify the object according to its test object
description, it assigns a value to the CreationTime test object property. This value indicates the order in
which the browser was opened relative to other open browsers with an otherwise identical description.
The first browser that opens receives the value CreationTime = 0.
During the run session, if QTP is unable to identify a browser object based solely on its test object
description, it examines the order in which the browsers were opened, and then uses the CreationTime
property to identify the correct one. For example, if we record a test on three otherwise identical browsers
that are opened at 9:01 pm, 9:03 pm, and 9:05 pm, QTP assigns the CreationTime values, as follows:
CreationTime = 0 to the 9:01 am browser, CreationTime = 1 to the 9:03 am browser, and CreationTime =
2 to the 9:06 am browser. At 10:30 pm, when we run our test, suppose the browsers are opened at 10:31
pm, 10:33pm, and 10:34 pm. QTP identifies the browsers, as follows: the 10:31 pm browser is identified
with the browser test object with CreationTime = 0, 10:33 pm browser is identified with the test object with
CreationTime = 1, 10:34 pm browser is identified with the test object with CreationTime = 2.
<<<<<< =================== >>>>>>
Q. 57: What is the Smart Identification Process of QTP
If QTP activates the Smart Identification mechanism during a run session, it follows the following process
to identify the object:
1 QTP forgets the learned test object description and creates a new object candidate list containing the
objects that match all of the properties defined in the Base Filter Properties list.
2 QTP filters out any object in the object candidate list that does not match the first property listed in the
Optional Filter Properties list. The remaining objects become the new object candidate list.
3 QTP evaluates the new object candidate list:
# If the new object candidate list still has more than one object, QTP uses the new (smaller) object
candidate list to repeat step 2 for the next optional filter property in the list.
# If the new object candidate list is empty, QTP ignores this optional filter property, returns to the previous
object candidate list, and repeats step 2 for the next optional filter property in the list.
# If the object candidate list contains exactly one object, then QTP concludes that it has identified the
object and performs the statement containing the object.
4 QTP continues the process described in steps 2 and 3 until it either identifies one object, or runs out of
optional filter properties to use. If, after completing the Smart Identification elimination process, QTP still
cannot identify the object, then QTP uses the learned description plus the ordinal identifier to identify the
object. If the combined learned description and ordinal identifier are not sufficient to identify the object,
then QTP stops the run session and displays a Run Error message.
<<<<<< =================== >>>>>>
Q. 58: What happens in case Smart Identification fails to identify the object in QTP?
If the Smart Identification mechanism cannot successfully identify the object, QTP uses the learned
description plus the ordinal identifier to identify the object.
If the object is still not identified, the test fails and a normal failed step is displayed in the results.
<<<<<< =================== >>>>>>
Q. 59: What is the use of Repository Parameters in QTP?
Repository parameters enable us to specify that certain property values should be parameterized, but
leave the actual parameterization to be defined in each test that is associated with the object repository
that contains the parameterized test object property values.
Repository parameters are useful when we want to create and run tests on an object that changes
dynamically. An object may change dynamically if it is frequently updated in the application, or if its
property values are set using dynamic content, for example, from a database.
<<<<<< =================== >>>>>>
Q. 60: How can we locate Test Objects in an Object Repository?
We can search for a specific test object in our object repository in many ways. We can search for a test
object according to its type. For example, we can search for a specific edit box, or we can point to an
object in our application to automatically highlight that same object in our repository. We can replace

specific property values with other property values. For example, we can replace a property value
userName with the value user name.
We can also select an object in our object repository and highlight it in our application to check which
object it is.After making sure that we shared object repository is the active window, we locate an object in
a shared object repository in the same way as we locate it in a local object repository. If we want to
replace property values, we must also make sure that the object repository is editable.
<<<<<< =================== >>>>>>
Q. 61: How can we perform Merge Operations among various Object Repositories?
The Object Repository Merge Tool enables us to merge test objects from the local object repository of
one or more actions to a shared object repository using the Update from Local Repository option in the
Object Repository Manager.
For example, we may have learned test objects locally in a specific action in our test and want to add
them to the shared object repository so they are available to all actions in different tests that use that
object repository. We can also use the Object Repository Merge Tool to merge two shared object
repositories into a single shared object repository.
We open the Object Repository Merge Tool by choosing Tools > Object Repository Merge Tool in the
Object Repository Manager.
<<<<<< =================== >>>>>>
Q. 62: How can we perform Import & Export Operations among various Object Repositories?
We can import and export object repositories from and to XML files. XML provides a structured,
accessible format that enables us to make changes to object repositories using the XML editor of our
choice and then import them back into QTP.
We can import and export files either from and to the file system or a Quality Center project.
We can import an XML file as an object repository. The XML file can either be an object repository that
we exported to XML format using the Object Repository Manager, or an XML file created using a tool
such as QTP Siebel Test Express or a custom built utility. We must adhere to the XML structure and
format.
<<<<<< =================== >>>>>>
Q. 63: How can we Integrate QTP with Quality Center?
We integrate QTP with Quality Center using the Quality Center Connectivity Add-in. This add-in is
installed on our QTP computer automatically when we connect QTP to Quality Center using the Quality
Center Connection dialog box. We can also install it manually from the Quality Center Add-ins page
(available from the Quality Center main screen) by choosing Quality Center Connectivity. Integrating QTP
with Quality Center enables us to store and access QTP tests and function libraries in a Quality Center
project, when QTP is connected to Quality Center.
<<<<<< =================== >>>>>>
Q. 64: What is the use of Template Tests in QTP?
Template tests serve as the basis for all QTP tests created in Quality Center. A template test is a QTP
test that contains default test settings. For example, a template test might specify the QTP add-ins,
associated function libraries, and recovery scenarios that are associated with a test. We can modify these
test settings in the Test Settings dialog box (File >Settings) in QTP.
In addition to default test settings, a template test can also contain any comments or steps we want to
include with all new QTP tests created in Quality Center. For example, we may want to add a comment
notifying users which add-ins are associated with the template test,or we may want to add a step that
opens a specific Web page or application at the beginning of every test. Any steps or comments we add
to a template test are included in all new tests created in Quality Center that are based on that template
test.
<<<<<< =================== >>>>>>
Q. 65: How can we create a QTP Test in Quality Center?
In Quality Center, we create QTP tests in the Test Plan module. When you create a QTP test, we apply a
template test to it. We can choose either the default template test stored on our QTP client, or a template
test that is saved in our Quality Center project.

If we do not have any template tests saved in our Quality Center project, or if we choose in the Template
box, Quality Center uses the settings defined in the template test that was installed with the QTP Add-in
for Quality Center on our Quality Center client.
<<<<<< =================== >>>>>>
Q. 66: What is Business Process Testing Model?
The Business Process Testing model is role-based, allowing non-technical Experts working in Quality
Center to collaborate effectively with Automation Engineers working in QTP. Non-technical Subject Matter
Experts define and document business processes, business components, and business process tests,
while Automation Engineers define the required resources and settings, such as shared object
repositories, function libraries, and recovery scenarios. Together, they can build, data-drive, document,
and run business process tests, without requiring programming knowledge on the part of the Nontechnical Subject Matter Expert.
<<<<<< =================== >>>>>>
Q. 67: What is the role of Subject Matter Expert in the Business Process Testing Model?
The Subject Matter Expert has specific knowledge of the application logic, a high-level understanding of
the entire system, and a detailed understanding of the individual elements and tasks that are fundamental
to the application being tested. This enables the Subject Matter Expert to determine the operating
scenarios or business processes that must be tested and identify the key business activities that are
common to multiple business processes. During the design phase, the Subject Matter Expert works with
the Automation Engineer to identify the resources and settings needed to automate the components,
enabling the Automation Engineer to prepare them. The Subject Matter Expert configures the values used
for business process tests, runs them in test sets, and reviews the results. The Subject Matter Expert is
also responsible for maintaining the testing steps for each of the individual business components. While
defining components, Subject Matter Experts continue collaborating with the Automation Engineer.
<<<<<< =================== >>>>>>
Q. 68: What is the role of Automation Engineer in the Business Process Testing Model?
The Automation Engineer is an expert in using an automated testing tool, such as QTP. The Automation
Engineer works with the Subject Matter Expert to identify the resources that are needed for the various
business process tests. The Automation Engineer then prepares the resources and settings required for
testing the features associated with each specific component, and stores them in an application area
within the same Quality Center project used by the Subject Matter Experts who create and run the
business process tests for the specific application. The Automation Engineer uses QTP features and
functionality to create these resources from within QTP.
<<<<<< =================== >>>>>>
Q. 69: What are the Differences Between Components and Tests?
# A component is a single entity. It cannot contain multiple actions or have calls to other actions or to
other components.
# When working with components, all external files are stored in the Quality Center project to which we
are currently connected.
# The name of the component node in the Keyword View is the same as the saved component. We
cannot rename the node.
# Business components are created in the Keyword View, not the Expert View.
# We add resources via the components application area, and not directly to the component.
# Components use custom keywords created in function libraries to perform operations, such as verifying
property values and opening the application we are testing.
<<<<<< =================== >>>>>>
Q. 70: How can we compare objects among two object repositories?
In QTP, we can compare existing assets from two object repositories using the Object Repository
Comparison Tool. The tool is accessible from the Object Repository Manager, and enables us to compare
different object repository resources, or different versions of the same object repository resource, and
identify similarities, variations, or changes.
Differences between objects in the two object repository files, named the First and Second files, are
identified according to default rules. During the comparison process, the object repository files remain

unchanged. After the compare process, the Comparison Tool provides a graphic presentation of the
objects in the object repositories, which are shown as nodes in a hierarchy.
<<<<<< =================== >>>>>>
Q. 71: What are the various types of objects identified by the comparison tool in QTP?
1) Identical: Objects that appear in both object repository files. There is no difference in their name or in
their properties.
2) Matching description, different name: Objects that appear in both object repository files that have
different names, but the same description properties and values.
3) Similar description: Objects that appear in both object repository files that have similar, but not
identical, description properties and values. One of the objects always has a subset of the properties set
of the other object. This implies that it is likely to be a less detailed description of the same object. For
example, an object named Button_1 in the second object repository has the same description properties
and values as an object named Button_1 in the first object repository, but also has additional properties
and values. Objects that do not have a description, such as Page or Browser objects, are compared by
name only. If the same object is contained in both the object repositories but with different names, they
will be shown in the object repositories as two separate objects.
4) Unique to first file, or Unique to second file. Objects that appear in only one of the object repository
files.
<<<<<< =================== >>>>>>
Q. 72: What are the situations best suited to Recording in QTP?
Recording can be useful in the following situations:
# Recording helps novice QTP users learn how QTP interprets the operations we perform on our
application, and how it converts them to QTP objects and built-in operations.
# Recording can be useful for more advanced QTP users when working with a new application or major
new features of an existing application. Recording is also helpful while developing functions that
incorporate built-in QTP keywords.
# Recording can be useful when we need to quickly create a test that tests the basic functionality of an
application or feature, but does not require long-term maintenance.
<<<<<< =================== >>>>>>
Q. 73: What are the advantages of Keyword Driven testing in QTP?
1) Keyword-driven testing enables us to design our tests at a business level rather than at the object
level.
2) By incorporating technical operations, such as a synchronization statement that waits for client-server
communications to finish, into higher level keywords, tests are easier to read and easier for less technical
application testers to maintain when the application changes.
3) Keyword-driven testing naturally leads to a more efficient separation between resource maintenance
and test maintenance. This enables the automation experts to focus on maintaining objects and functions
while application testers focus on maintaining the test structure and design.
4) When we record tests, we may not notice that new objects are being added to the local object
repository. This may result in many testers maintaining local object repositories with copies of the same
objects. When using a keyword-driven methodology, we select the objects for our steps from the existing
object repository. When we need a new object, we can add it to our local object repository temporarily,
but we are also aware that we need to add it to the shared object repository for future use.
<<<<<< =================== >>>>>>
Q. 74: What are Absolute and Relative Paths in QTP?
We can save QTP resources, such as shared object repositories, function libraries, recovery scenarios or
environments, using absolute or relative paths.
1) An absolute path: Describes the full path to a specific file starting from a fixed location such as the root
directory, or the drive on which the file is located, and contains all the other sub-directories in the path. An
absolute path always points to the specified file, regardless of the current directory.
2) A relative path: Describes the path to a specific file starting from a given directory, and is generally only
a portion of the absolute path. A relative path therefore specifies the location of the file relative to the
given location in the file system. Using relative paths means that the paths remain valid when files or
folders containing files are moved or copied to other locations or computers, provided that they are
moved within the same folder structure. For this reason, we recommend that we use relative paths when
saving resources in QTP.

<<<<<< =================== >>>>>>


Q. 75: What are the situations best suited to Keyword-driven methodology in QTP?
The keyword-driven methodology is especially useful for organizations that have both technical and less
technical users because it offers a clear division of automation tasks. This enables a few experts to
maintain the resource framework while less technical users design and maintain automated test steps.
Additionally, once the basic infrastructure is in place, both types of users can often do their tasks
simultaneously.
<<<<<< =================== >>>>>>
Q. 76: What are the steps for implementing tests with Keyword Driven Methodology?
Step 1: Analyze the application to find out the testing needs: In this step, web determine our applications
development environment, such as Web, Java, or .NET, so that we can load the required QTP add-ins.
We also find out the business processes and functionality we want to test.
Step 2: Set up object repositories: After we decide what we want to test and how to divide our actions, we
build the set of resources to be used by our tests. The most widely used resource is the shared object
repository.
Step 3: Create function libraries: After we create our object repositories, we create function libraries
containing functions that extend QTP functionality. Application testers can use these keywords to build
keyword-driven tests.
Step 4: Configure QTP according to our testing needs: Here we set up the global testing preferences, run
session preferences, and any test-specific preferences. If needed, we can create recovery scenarios that
instruct QTP how to proceed when a step fails. We also configure the QTP window so that we can easily
access any needed panes, such as the Test Flow pane, the Resources pane, and the Available
Keywords pane.
Step 5: Build the tests: We now construct our tests by inserting calls to the relevant actions from our
tests. Create one or more empty tests and add actions to them. Make sure that we associate our object
repositories with the relevant actions, and associate our function libraries and recovery scenarios with the
relevant tests, so that we can insert steps using keywords. We may also need to configure test
preferences at this point.
Step 6: Add steps to the test actions: Add steps that use the keywords we created in previous steps. We
can then enhance our tests by inserting checkpoints and output values to verify that our application is
behaving according to expectations. We can add programmatic statements to further enhance our tests.
Step 7: Run, analyze, and troubleshoot our tests: When our tests are ready, we run them, view the run
results, and troubleshoot our tests, as needed.
<<<<<< =================== >>>>>>
Q. 77: How do we analyze our application to determine our testing needs using QTP?
1) Determine the development environments that QuickTest needs to support: Our application comprises
of windows containing a hierarchy of objects that were created in one or more development
environments. QTP provides support for these environments using add-ins. We load QTP add-ins when
QTP opens by using the Add-in Manager dialog box. We can check which add-ins are loaded by
choosing Help > About QTP.
2) Prepare the information that QTP needs to identify objects in our application and to open our
application at the beginning of a run session. We need to know the URL, the executable file name and
path, or other command-line information. Later, we will enter this in Record and Run Settings dialog box.
3) Navigate through our application from a custmers perspective and perform the tasks that customers
might perform. We create an action for each sub-process, or task, a customer might perform. Each
process we perform in our application will be represented as a test in QTP. We can create our tests now.
<<<<<< =================== >>>>>>
Q. 78: In what situations recording mechanism shall be useful in creating tests in QTP?
1) We are new to QTP and want to learn how QTP interprets the operations we perform on our
application and how it converts them to QTP objects and built-in operations.
2) We need to quickly create a test that tests the basic functionality of an application or feature, and the
test does not require long-term maintenance.
3) We are working with a new application or with major new features of an existing application, and we
want to learn how QTP interacts with the application.
4) We are developing functions that incorporate built-in QTP keywords.
<<<<<< =================== >>>>>>

Q. 79: What are the various Recording Modes in QTP?


1) Normal or the default recording mode: This records the objects in our application and the operations
performed on them. This mode takes full advantage of the QTP object model, recognizing the objects in
our application regardless of their location on the screen.
2) Analog Recording: This enables us to record the exact mouse and keyboard operations we perform in
relation to either the screen or the application window. In this recording mode, QTP records and tracks
every movement of the mouse as we drag the mouse around a screen or window.
3) Low Level Recording:This enables us to record on any object in our application, whether or not QTP
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.
<<<<<< =================== >>>>>>
Q. 80: How can we switch to Low Level Recording mode while editing a test?
We can switch to Low Level Recording mode only while recording a test. The option is not available while
editing a test.
<<<<<< =================== >>>>>>
Q. 81: What is the use of Keyword View in QTP?
The Keyword View enables us to create and view the steps of our test in a modular, table format. Each
step is a row in the Keyword View that is comprised of individual, modifiable parts. We create and modify
steps by selecting items and operations in the Keyword View and entering information as required. Each
step is automatically documented as we complete it, enabling us to view a description of our test in
understandable sentences.
<<<<<< =================== >>>>>>
Q. 82: What are Conditional and Loop Statements used in the Keyword View in QTP?
Using conditional statements, we can incorporate decision making into the tests. Using loop statements,
we can run a group of steps repeatedly, either while or until a condition is true. We can also use loop
statements to repeat a group of steps a specific number of times. A few conditional & Loop statements
are given below:
1) IfThen statement
2) ElseIfThen statement
3) Else statement
4) WhileWend statement
5) ForNext statement
6) DoWhile statement
7) DoUntil statement
<<<<<< =================== >>>>>>
Q. 83: What is the use of a Comment in the Comment cell of a step in QTP?
A Comment is free text entry which can help improve readability and make a test easier to update. For
example, we may want to add a comment step at the beginning of each action to specify what that
section includes.QTP does not process comments when it runs a test.
<<<<<< =================== >>>>>>
Q. 84: What are Nesting Actions & what is the use of them?
Sometimes we may want to call an action from within an action. This is called nesting. By nesting actions,
you can:
1) Maintain the modularity of your test.
2) Run one or more actions based on the results of a conditional statement.
<<<<<< =================== >>>>>>
Q. 85: Splitting Actions option is not available under what circumstances in QTP?
You cannot split an action, and the option is disabled when:
1) An external action is selected
2) The first step of an action is selected
3) We are working with a read-only test
4) Recording a test
5) Running a test
<<<<<< =================== >>>>>>

Q. 86: What is the use of Action Parameters in QTP?


Action parameters enable us to transfer input values from our test to a top-level action, from a parent
action to a nested action, or from an action to a sibling action that occurs later in the test. We can use
action parameters in any step in our action including function calls.
<<<<<< =================== >>>>>>
Q. 87: What are the various types of Exit Action Statements in QTP?
There are four types of exit action statements we can use:
1) ExitAction: Exits the current action, regardless of its iteration attributes.
2) ExitActionIteration: Exits the current iteration of the action.
3) ExitRun: Exits the test, regardless of its iteration attributes.
4) ExitGlobalIteration: Exits the current global iteration.
<<<<<< =================== >>>>>>
Q. 88: What is the use of Checkpoints in QTP?
A checkpoint is a verification point that compares a current value for a specified property with the
expected value for that property. This enables us to identify whether our application is functioning
correctly. When we run the test, QTP compares the expected results of the checkpoint to the current
results. If the results do not match, the checkpoint fails. We can view the results of the checkpoint in the
Test Results window.
<<<<<< =================== >>>>>>
Q. 89: What are the situations best suited for using an existing Checkpoint?
1) If each page of our application contains our organizations logo, we can reuse a bitmap checkpoint to
verify each occurrence in the application.
2) If our application contains multiple edit boxes, we can reuse a checkpoint to confirm the enabled status
of these edit boxes throughout our test.
<<<<<< =================== >>>>>>
Q. 90: What is the reason that Add Existing Checkpoint dialog box is not visible?
Add Existing Checkpoint dialog box option is available only if at least one of the object repositories
associated with the current action (including the local object repository) contains at least one checkpoint.
<<<<<< =================== >>>>>>
Q. 91: What is a Standard Check Point in QTP?
It is a checkpoint which checks the property value of an object in our application. The standard checkpoint
checks a variety of objects such as buttons, radio buttons, combo boxes, lists, and so forth. For example,
we can check that a radio button is activated after it is selected or we can check the value of an edit box.
Standard checkpoints are supported for all add-in environments.
<<<<<< =================== >>>>>>
Q. 92: What is a Image Check Point in QTP?
It is a checkpoint which checks the value of an image in our application. For example, we can check that
a selected images source file is correct. Image checkpoint is created by inserting a standard checkpoint
on an image object. Image checkpoints are supported for the Web add-in environment.
<<<<<< =================== >>>>>>
Q. 93: What is a Bitmap Check Point in QTP?
It is a checkpoint which checks an area of our application as a bitmap. For example, suppose we have a
Web site that can display a map of a city the user specifies. The map has control keys for zooming. We
can record the new map that is displayed after one click on the control key that zooms in the map. Using
the bitmap checkpoint, we can check that the map zooms in correctly. We can create a bitmap checkpoint
for any area in our application, including buttons, text boxes, and tables. Bitmap checkpoints are
supported for all add-in environments
<<<<<< =================== >>>>>>
Q. 94: What is a Table Check Point in QTP?
It is a checkpoint which checks information within a table. For example, suppose our application contains
a table listing all available flights from New Delhi to Chennai. We can add a table checkpoint to check that
the time of the first flight in the table is correct. We create a table checkpoint by inserting a standard
checkpoint on a table object. Table checkpoints are supported for Web, ActiveX, Java, Oracle, and .NET
Windows Forms environments, as well as other add-in environments
<<<<<< =================== >>>>>>
Q. 95: What is a Text Check Point in QTP?

It is a checkpoint which checks that a text string is displayed in the appropriate place on a Web page or
application. For example, suppose a Web page displays the sentence Flight departing from New Delhi to
Chennai. We can create a text checkpoint that checks that the words New Delhi are displayed between
Flight departing from and to Chennai. Text checkpoints are supported for most add-in environments
<<<<<< =================== >>>>>>
Q. 96: What is a Text Area Check Point in QTP?
It is a checkpoint which checks that a text string is displayed within a defined area in a Windows-based
application, according to specified criteria. For example, suppose our Visual Basic application has a
button that says View Doc , where is replaced by the four digit code entered in a form elsewhere in the
application. We can create a text area checkpoint to confirm that the number displayed on the button is
the same as the number entered in the form. Text area checkpoints are supported for all Windows-based
environments, such as Standard Windows, Visual Basic, and ActiveX add-in environments
<<<<<< =================== >>>>>>
Q. 97: What is an Accessibility Check Point in QTP?
It is a checkpoint which identifies areas of our Web site that may not conform to the World Wide Web
Consortium (W3C) Web Content Accessibility Guidelines. For example, guideline 1.1 of the W3C Web
Content Accessibility Guidelines requires us to provide a text equivalent for every non-text element. We
can add an Alt property check to check whether objects that require the Alt property under this guideline,
do in fact have this tag. Accessibility checkpoints are supported for the Web add-in environment.
<<<<<< =================== >>>>>>
Q. 98: What is a Page Check Point in QTP?
It is a checkpoint checks the characteristics of a Web page. For example, we can check how long a Web
page takes to load or whether a Web page contains broken links. We create a page checkpoint by
inserting a standard checkpoint on a page object. Page checkpoints are supported for the Web add-in
environment.
<<<<<< =================== >>>>>>
Q. 99: What is a Database Check Point in QTP?
It is a checkpoint which checks the contents of a database accessed by our application. For example, we
can use a database checkpoint to check the contents of a database containing flight information for our
Web site. Database checkpoints are supported for all add-in environments
<<<<<< =================== >>>>>>
Q. 100: What is a XML Check Point in QTP?
It is a checkpoint which checks the data content of XML documents in XML files or XML documents in
Web pages and frames. The XML Checkpoint option is supported for the Web add-in environment & for
all add-in environments.
<<<<<< =================== >>>>>>
Q. 101: What is the process of capturing visible portion of an object in QTP?
QTP captures the visible part of the specified object as a bitmap and inserts a checkpoint in the test. QTP
does not capture any part of the screen which happens to be scrolled off the screen. We can check an
area of an application as a bitmap. While creating a test, we specify the area you want to check by
selecting an object. We can check an entire object or any area within an object.
<<<<<< =================== >>>>>>
Q. 102: What is the process of comparing selected area of object with Bitmap stored in the
checkpoint?
When we run the test, QTP compares the object or selected area of the object in the application with the
bitmap stored in the checkpoint. If there are differences, QTP captures a bitmap of the actual object and
displays it with the expected bitmap in the details portion of the Test Results window. By comparing the
two bitmaps (expected and actual), we can identify the nature of the discrepancy.
<<<<<< =================== >>>>>>
Q. 103: How can we define a time interval for QTP to perform a checkpoint successfully?
For defining some time interval (say in seconds) during which QTP should attempt to perform the
checkpoint successfully, we need to specify the Checkpoint Timeout. QTP continues to perform the
checkpoint until it passes or until the timeout occurs. If the checkpoint does not pass before the timeout
occurs, the checkpoint fails. For example, suppose it takes some time for an object to achieve an
expected state. Increasing the checkpoint timeout value in this case can help ensure that the object has

sufficient time to achieve that state, enabling the checkpoint to pass (if the data matches) before the
maximum timeout is reached.
<<<<<< =================== >>>>>>
Q. 104: How can we check the object property values in our application?
We can check that a specified object in our application has the property values we expect, by adding a
standard checkpoint step to our test while recording or editing the test. Standard checkpoints compare
the expected values of object properties to the objects current values during a run session. We can use
standard checkpoints to perform checks on images, tables, Web page properties, and other objects within
our application.
<<<<<< =================== >>>>>>
Q. 105: How can we identify a checkpoint in QTP?
We identify a checkpoint by its name. By default, the checkpoint name is the same as the name of the
test object on which the checkpoint was created. We can specify a different name for the checkpoint or
accept the default name. If we want to rename a checkpoint, make sure that the name is unique, and it
does not begin or end with a space, and does not contain the special characters like := @@
<<<<<< =================== >>>>>>
Q. 106: How can we Insert statement option when adding a checkpoint during the recording?
The Insert statement option is not available when adding a checkpoint during recording or when
modifying an existing object checkpoint. It is available only when adding a new checkpoint to an existing
test while editing it.
<<<<<< =================== >>>>>>
Q. 107: How can we compare the image files in the Image Checkpoint?
We can compare the image files in the Image Checkpoint by using the Compare image content option in
the Image Checkpoint Properties dialog box. It compares the expected image source file with the graphic
of the actual image source file. If the expected and actual images are different, QTP displays them both in
the Test Results. If the images are identical, only one graphic is displayed.
<<<<<< =================== >>>>>>
Q. 108: How can we check the contents of tables in our application in QTP?
We can check the contents of tables in our application by adding table checkpoints to the test. For
example, we can check that a specified value is displayed in a particular cell. We can also check the
properties of the table object. For example, we can check that a table has the expected number of rows
and columns. When we run the test, the table checkpoint compares the actual data to the expected data,
as defined in the checkpoint. If the results match, the checkpoint passes.
<<<<<< =================== >>>>>>
Q. 109: How do we compare actual cell values with the expected cell values in Tables in QTP?.
By using the Settings tab we can compare actual cell values with the expected cell values in tables. By
using Verification type option we can compare following types of cell contents.
1) String Content: It is the default setting. It treats the cell values as strings and checks for the exact text,
while ignoring spaces. For example, 2 and 2.00 are not recognized as the same string.
2) Numeric Content: Evaluates the content of the cell according to numeric values. For example, 2 and
2.00 are recognized as the same number.
3) Numeric Range: Compares the content of the cell against a numeric range, where the minimum and
maximum values are any real number that we specify.
<<<<<< =================== >>>>>>
Q. 110: How can we check the location of a cell to be checked in a Column of a table?
By the use of Identify columns option available in Cell Identification tab. This specifies the location of the
column containing the cells with which we want to compare the expected data. This is done in two ways:
1) By position: This is the Default option. It locates cells according to the column position. A shift in the
position of the columns within the table results in a mismatch.
2) By column name: It locates cells according to the column name. A shift in the position of the columns
within the table does not result in a mismatch. This option gets enabled only when the table contains
more than one column.
<<<<<< =================== >>>>>>
Q. 111: How can we check the location of a cell to be checked in a Row of a table?
By the use of Identify columns option available in Cell Identification tab. This specifies the location of the
row containing the cells with which you want to compare the expected data. This is done in two ways:

1) By row number: This is the Default option. It locates cells according to the row position. A shift in the
position of any of the rows within the table results in a mismatch.
2) By selected key columns: It locates the rows containing the cells to be checked by matching the value
of the cell whose column was previously selected as a key column. A shift in the position of the row does
not result in a mismatch. If more than one row is identified, QTP checks the first matching row. We can
use more than one key column to uniquely identify any row.
<<<<<< =================== >>>>>>
Q. 112: How can we ensure that a text string appears in a specified area in QTP?
With the help of Text Area Checkpoint, we can ensure that a particular text string appears within a
defined area in a Windows application, according to the specified criteria. It is supported for a variety of
QTP add-in environments, like Standard Windows, Java, Visual Basic, and ActiveX etc.
<<<<<< =================== >>>>>>
Q. 113: How QTP retrieves Text while checking the text during the test?
QTP tries to retrieve the text directly from the object. If QTP cannot retrieve the text in this manner in
some case where the text happens to be the part of a picture, it tries to retrieve the text using an OCR
commonly known as optical character recognition mechanism.
<<<<<< =================== >>>>>>
Q. 114: How can we check the databases accessed by our application in QTP?
We can use database checkpoints to check the databases accessed by your application. For this, we
define a query on the database. Then we create a database checkpoint for checking the results of the
query. A database query can be defined in two ways like:
1) By Microsoft Query: We can install Microsoft Query from the custom installation of the Microsoft Office.
2) By manually defining an SQL statement.
<<<<<< =================== >>>>>>
Q. 115: How can we check a current data value with a value stored in a database in QTP?
With the help of database checkpoint we can check a current data value with a value stored in the
database. When we run the test, the database checkpoint compares the current data in the database to
the expected data defined in the Database Checkpoint Properties dialog box. If the expected data and the
current results do not match, the database checkpoint fails.
<<<<<< =================== >>>>>>
Q. 116: What is the maximum number of rows, which can be defined in a database in QTP?
We can specify a maximum of 32,000 rows.
<<<<<< =================== >>>>>>
Q. 117: What is XML?
XML also called as Extensible Markup Language is a meta-markup language for text documents. This is
recognized as a standard by the World Wide Web Consortium or called W3C in short. XML makes the
complex data structures portable between different computer environments and programming languages,
facilitating the sharing of data.XML files contain text with simple tags that describe the data within an XML
document. These tags describe the data content, but not the presentation of the data. Applications that
display an XML document or file use either Cascading Style Sheets (CSS) or XSL Formatting Objects
(XSL-FO) to present the data.
<<<<<< =================== >>>>>>
Q. 118: How can we verify the data content of XML files?
With the help of XML checkpoints, we can verify the data content of XML files. Common uses of XML
checkpoints are:
1) We can validate that the data has not changed from one application release to the other.
2) We can check the content of an element to make sure that its tags, attributes, and values have not
changed.
3) We can verify that the web service returns the XML in the expected structure and with the expected
values.
<<<<<< =================== >>>>>>
Q. 119: What are the various types of XML checkpoints in QTP?
We can create three types of XML checkpoints in QTP:
1) XML Web Page / Frame Checkpoint: This checks an XML document within a Web page or frame.
2) XML File Checkpoint: This checks a specified XML file.
3) XML Test Object Checkpoint: This checks the XML data for an object or operation.

<<<<<< =================== >>>>>>


Q. 120: What is the use of XML Checkpoints on Web service operations?
XML Checkpoints on Web service operations compare the expected values of the checkpoint
to the actual values returned from the last native Web service operation performed on the test object.
If a different Web service operation step is performed prior to the checkpoint, then the checkpoint will fail.
<<<<<< =================== >>>>>>
Q. 121: What is the use of XML Tree?
XML tree displays the hierarchical relationship between each element and value in the XML tree, enabling
us to select the specific elements, attributes and values we want to check. Each element is displayed with
a (X) icon. Each value is displayed with a (V) icon.
<<<<<< =================== >>>>>>
Q. 122: How many types of element checks are available in XML Checkpoints in QTP?
1) Check number of attributes: It checks the number of attributes that are attached to the element.
2) Check number of child element occurrences in block: Displays the number of child elements
associated with the selected parent element. If we select this option, QTP verifies that the number of child
elements in your XML tree corresponds to the number that appears in the Check number of child element
occurrences in block field.
<<<<<< =================== >>>>>>
Q. 123: What is Schema Validation?
We can activate Schema Validation button to confirm that the XML in our application or file adheres to the
structure defined in a specific XML schema or schemas. We can validate the structure of the XML we are
checking using one or more external schema files or using schema embedded within our XML document.
<<<<<< =================== >>>>>>
Q. 124: What are the methods to populate the XML Tree?
We can use any one of the following three methods to populate the XML tree:
1) Updating the XML Tree Manually
2) Importing an XML Tree from a File
3) Updating the XML Tree Using Update Run Mode
<<<<<< =================== >>>>>>
Q. 125: What are the special guidelines for Schema Validation?
We consider following guidelines when specifying a schema file to validate our XML.
1) If we are validating an XML file using a schema defined in the XML file, the schema can be defined
with an absolute or relative path. When we specify a relative path, QTP searches for the schema in the
folders listed in the Folders tab of the Options dialog box.
2) If we are validating an XML document located on the Web with a schema file located on our file
system, we cannot use UNC format (for example, \\ComputerName\Path\To\Schema) to specify the
schema file location. Instead, map the schema file location to a network drive.
3) If there is a schema with a namespace defined in our XML document, the namespace of the external
schema must be identical to the one defined in our document.
4) When we perform a schema validation, QTP validates all of the elements in the XML document, even if
certain XML elements are not associated with a schema file. Any XML elements that are not associated
with a schema file will cause the schema validation to fail.
<<<<<< =================== >>>>>>
Q. 126: What is the use of Parameterizing in QTP?
We can use the parameter feature in QTP to enhance our test by parameterizing the values that it uses.
A parameter is a variable that is assigned a value from an external data source or generator. We can
parameterize values in steps and checkpoints in your test. We can also parameterize the values of action
parameters.
<<<<<< =================== >>>>>>
Q. 127: What is the use of Data Driver when adding parameters in QTP?
If we want to parameterize the same value in several steps in our test, it is better to use the Data Driver
rather than adding parameters manually.
<<<<<< =================== >>>>>>
Q. 128: How can we parameterize a step in QTP?

We can parameterize a step by using a test or action input parameter. This enables the step to use
values that have been passed from the application that ran our test. For example, we can use an input
test parameter as the value for a method argument.
<<<<<< =================== >>>>>>
Q. 129: What is the use of Data Table Parameters in QTP?
We can supply the list of possible values for a parameter by creating a Data Table parameter. Data Table
parameters enable us to create a data-driven test, or action that runs several times using the data you
supply. In each repetition, or iteration, QTP uses a different value from the Data Table. We could conduct
the test by accessing the Web site and recording the submission of numerous queries. This is a slow,
laborious, and inefficient solution. By using Data Table parameters, we can run the test for multiple
queries in succession.
<<<<<< =================== >>>>>>
Q. 130: What are the options available for configuring Data Table Parameters?
1) Name: Specifies the name of the parameter in the Data Table. We can create a new parameter by
using the default parameter name or entering a new, descriptive name. Alternatively, we can select an
existing Data Table parameter from the list.
2) Location in Data Table: Specifies whether to store the parameter in the global or current action sheet in
the Data Table.
<<<<<< =================== >>>>>>
Q. 131: What is the use of Data Table formula in parameterization of data tables?
Data Table formula option inserts two columns in the Data Table. The first column contains a formula that
checks the validity of output in the second column. QTP uses the data in the output column to compute
the formula, and inserts a value of TRUE or FALSE in the table cell of the formula column. This option is
available only for the checkpoints.
<<<<<< =================== >>>>>>
Q. 132: What is the use of Global Data Table parameters in QTP?
Global Data Table parameters take data from the Global sheet in the Data Table. The Global sheet
contains the data that replaces global parameters in each iteration of the test. By default, the test runs
one iteration for each row in the Global sheet of the Data Table. Using the Run tab of the Test Settings
dialog box, we can also set the test to run only one iteration, or to run iterations on specified rows within
the Global sheet of the Data Table. We can use the parameters defined in the Global data sheet in any
action.
<<<<<< =================== >>>>>>
Q. 133: What is the use of Local Data Table parameters in QTP?
Local Data Table parameters take data from the actions sheet in the Data Table. The data in the actions
sheet replaces the actions Data Table parameters in each iteration of the action. By default, actions run
only one iteration. If we have multiple rows in a local data sheet, the corresponding action runs multiple
times before running the next action in the test.
<<<<<< =================== >>>>>>
Q. 134: What is the use of Environment parameters in QTP?
Environment parameters are useful for localization testing, when we want to test an application where the
user interface strings change, depending on the selected language. Environment parameters can be used
for testing the same application on different browsers. We can also vary the input values for each
language by selecting a different Data Table file each time we run the test.
<<<<<< =================== >>>>>>
Q. 135: What are the types of Environment Variables in QTP?
1) User-Defined Internal Variables: These are the variables that we define within the test. These variables
are saved with the test and are accessible only within the test in which they were defined.
2) User-Defined External Variables: These are the variables that we predefine in the active external
environment variables file. We can create as many files as we want and select an appropriate file for each
test, or change files for each test run.
3) Built-in Variables: These are the variables that represent information about the test and the computer
on which the test is run, such as Test path and Operating system. These variables are accessible from all
tests, and are designated as read-only.
<<<<<< =================== >>>>>>
Q. 136: How do we use User-Defined External Environment Variables in QTP?

We can create a list of variable-value pairs in an external file in .xml format. We can then select the file as
the active external environment variable file for a test and use the variables from the file as parameters.
We can set up your environment variable files manually, or we can define the variables in the
Environment tab of the Test Settings dialog box and use the Export button to create the file with the
correct structure.
<<<<<< =================== >>>>>>
Q. 137: Can we create many external variable files with same names & different values?
we can create several external variable files with the same variable names and different values and then
run the test several times, using a different file each time. This is quite useful for localization testing.
<<<<<< =================== >>>>>>
Q. 138: How to use Environment Variable Files with Quality Center?
When working with Quality Center and environment variable files, we must save the environment variable
file as an attachment in our Quality Center project before we specify the file in the Environment tab of the
Test Settings dialog box. We can add a new or an existing environment variable file to our Quality Center
project. Note that adding an existing file from the file system to a Quality Center project creates a copy of
the file in Quality Center. Thus, once we save the file to the project, changes made to the Quality Center
environment variable file will not affect the file system file and vice versa.
<<<<<< =================== >>>>>>
Q. 139: Where do we use Built-in Environment Variables in QTP?
QTP provides a set of built-in variables that enable us to use current information about the test and the
QTP computer running our test. These can include the test name, the test path, the operating system
type and version, and the local host name. For example, we may want to perform different checks in our
test based on the operating system being used by the computer that is running the test. To do this, we
could include the OSVersion built-in environment variable in an If statement.
<<<<<< =================== >>>>>>
Q. 140: What are the options available for configuring Environment Variable Parameters?
1) Name option: Specifies the name of the parameter. For an internal user-defined environment variable
parameter, we can create a new parameter by using the default parameter name or entering a new,
descriptive name. Alternatively, we can select an existing internal user-defined environment variable
parameter from the list.
2) Value option: Specifies the value of the parameter. We can enter the value for a new user-defined
internal parameter, or modify the value for an existing user-defined internal parameter. External and builtin environment variable parameter values cannot be modified in this dialog box.
3) Type option: Specifies the type of environment variable parameter which are read-only:
a) Internal User-Defined
b) External User-Defined
c) Built-in
4) Regular expression option: Sets the value of the parameter as a regular expression. This option is
available only when parameterizing a checkpoint or object property text string value, and the selected
environment variable parameter type is internal user-defined.
<<<<<< =================== >>>>>>
Q. 141: What are the various options for configuring Random Number Parameters?
1) Numeric range: This option specifies the range from which the random number is generated. By
default, the random number range is between 0 and 100. We can modify the range by entering different
values in the From and To boxes. The range must be between 0 and 2147483647 (inclusive).
2) Name: This option assigns a name to our parameter. Assigning a name to a random parameter
enables us to use the same parameter several times in our test. We can select an existing named
parameter or create a new named parameter by entering a new, descriptive name.
3) Generate new random number: This option defines the generation timing for a named random
parameter. This box is enabled when we select the Name check box. We can select one of the following
options:
a) For each action iteration: This option generates a new number at the end of each action iteration.
b) For each test iteration: This option generates a new number at the end of each global iteration.
c) Once per entire test run: This option generates a new number the first time the parameter is used. The
same number is used for the parameter throughout the test run.
<<<<<< =================== >>>>>>

Q. 142: How do we use Random Number Parameters for Non-Numeric Values?


Random number parameters are not suitable for non-numeric values, such as text or hypertext links.
<<<<<< =================== >>>>>>
Q. 143: What is the use of Data Driver in parameterizing the tests?
Data Driver help us to quickly parameterize several property values for test objects, checkpoints, and
method arguments containing the same constant value within a given action.
We can choose to replace all occurrences of a selected constant value with a parameter, in the same
way that we can use a Find and Replace All operation instead of a step-by-step Find and Replace
process. QTP can show us each occurrence of the constant so that we can decide whether or not to
parameterize the value.
<<<<<< =================== >>>>>>
Q. 144: Can we use Data Driver to parameterize the VBScript functions?
We cannot use the Data Driver to parameterize the values of arguments for user-defined methods or
VBScript functions.
<<<<<< =================== >>>>>>
Q. 145: What is the use of Step-by-step parameterization option in Data Driver wizard?
Step-by-step parameterization enables us to view the current values of each step containing the selected
value. For each step, we can choose whether or not to parameterize the value and if so, which
parameterization options we want to use.
<<<<<< =================== >>>>>>
Q. 146: What is the use of Parameterize All option in Data Driver wizard?
Parameterize all option enables us to parameterize all occurrences of the selected value throughout the
action. We set our parameterization preferences one time and the same options are applied to all
occurrences of the value.
<<<<<< =================== >>>>>>
Q. 147: What is an Output Value Step in QTP?
An output value step is a step in which one or more values are captured at a specific point in our test and
stored for the duration of the run session. The values can later be used as input at a different point in the
run session.
<<<<<< =================== >>>>>>
Q. 148: What is the purpose of creating Output Value Steps in QTP
When we create output value steps, we can determine where the values are stored during the run
session and how they can be used. During the run session, QTP retrieves each value at the specified
point and stores it in the specified location. When the value is needed later n the run session, QTP
retrieves it from this location and uses it as required.
<<<<<< =================== >>>>>>
Q. 149: What are the various categories of output values in QTP?
we can create following categories of output values:
1) Standard output values
2) Text and text area output values
3) Table output values
4) Database output values
5) XML output values
<<<<<< =================== >>>>>>
Q. 150: What is the purpose of Standard Output Values in QTP?
we can use standard output values for following:
1) To output the property values of most objects. For example, in a Web-based application, the number of
links on a Web page may vary based on the selections a user makes on a form on the previous page. We
can create an output value in our test to store the number of links on the page.
2) To output the contents of table cells.
3) To output text strings by specifying the text property of the object as an output value.
<<<<<< =================== >>>>>>
Q. 151: What is the purpose of Text and Text Area Output Values in QTP?
We can use text output values to output text strings displayed in an application. When creating a text
output value, we can output a part of the objects text. We can also specify the text before and after the
output text.We can use text area output values to output text strings displayed within a defined area of

a screen in a Windows-based application.


<<<<<< =================== >>>>>>
Q. 152: What is the purpose of Table Output Values in QTP?
Table output values are a subset of standard output values, described above. We can use table output
values to output the contents of table cells. For some types of tables, we can specify a row range from
which to choose the table cells. During the run session, QTP retrieves the current data from the specified
table cells according to the settings that we specified and outputs the values to the Data Table.
<<<<<< =================== >>>>>>
Q. 153: What is the purpose of Database Output Values in QTP?
We can use database output values to output the value of the contents of database cells, based on the
results of a query that we define on a database. We can create output values from the entire contents of
the result set, or from a part of it. During the run session, QTP retrieves the current data from the
database and outputs the values according to the settings that we specified.
<<<<<< =================== >>>>>>
Q. 154: What is the purpose of XML Output Values in QTP?
We can use XML output values to output the values of XML elements and attributes in XML documents.
For example, suppose that an XML document in a Web page contains a price list for new cars. We can
output the price of a particular car by selecting the appropriate XML element value to output.
<<<<<< =================== >>>>>>
Q. 155: How the output values are stored during the run sessions?
When we define an output value, we can specify where and how each value is stored during the run
session. We can output a value to: A test or action parameter
2) The run-time Data Table
3) An environment variable Output values are stored only for the duration of the test, and are not saved
with the test.
<<<<<< ================== >>>>>>
Q. 156: How do we store output values in Test and Action Parameters?
We can output a value to an action parameter, so that values from one part of a run session can be used
later in the run session, or be passed back to the application that ran the test. For example, suppose we
are testing a shopping application that calculates our purchases and automatically debits our account with
the amount that we purchased. We want to test that the application correctly debits the purchase amount
from the account each time that the action is run with a different list of items to purchase. We could output
the total amount spent to an action parameter value, and then use that value later in our run session in
the action that debits the account.
<<<<<< =================== >>>>>>
Q. 157: How do we store output values in Run-time Data Table?
The option to output a value to the run-time Data Table is especially useful with a data- driven test that
runs several times. In each repetition, or iteration, QTP retrieves the current value and stores it in the
appropriate row in the run-time Data Table.
<<<<<< =================== >>>>>>
Q. 158: How do we store output values in Environment Variable?
When we output a value to an internal user-defined environment variable, we can use the environment
variable input parameter at a later stage in the run session. We can output values only to internal userdefined environment variables and not to external or built-in environment variables, which are read-only.
For example, suppose we are testing an application that prompts the user to input an account number on
a Welcome page and then displays the users name. We can use a text output value to capture the value
of the displayed name and store it in an environment variable.
<<<<<< =================== >>>>>>
Q. 159: In what situations we output a value for a step in a test action?
1) If at least one output parameter is defined in the action, the default output type is Test/action parameter
and the default output name is the first output parameter displayed in the Action Properties dialog box.
2) If no output parameters are defined in the action, the default output type is Data Table and QTP
creates a new Data Table output name based on the selected value.
<<<<<< =================== >>>>>>
Q. 160: What are the options available when outputting a value to the Data Table?

1) Name: Specifies the name of the column in the Data Table in which to store the value. QTP suggests a
default name for the output. We can select an existing output name from the list, or create a new output
name by using the default output name or entering a valid descriptive name. We can define a new name
containing letters, numbers, periods, and underscores. The first character of the output name must be a
letter or an underscore. The output name must be unique in the Data Table sheet.
2) Location in Data Table: When outputting values for a test, specifies whether to add the Data Table
column name in the global or current action sheet in the Data Table.
<<<<<< =================== >>>>>>
Q. 161: What is a Regular Expression?
A regular expression is a string that specifies a complex search phrase. By using special characters, such
as a period (.), asterisk (*), caret (^), and brackets ([ ]), we can define the conditions of a search.
<<<<<< =================== >>>>>>
Q. 162: What is the use of Regular expressions in QTP?
Regular expressions enable QTP to identify objects and text strings with varying values. We can use
regular expressions in situations like:
1) Defining the property values of an object in dialog boxes or in programmatic descriptions
2) Parameterizing a step
3) Creating checkpoints with varying values For example, we can use a regular expression if we want to
create a text checkpoint on a date text string, but the displayed date changes according to the current
date. If we define the date as a regular expression, the checkpoint checks that the captured text string
matches the expected date format, rather than checking the exact date value.
<<<<<< =================== >>>>>>
Q. 163: How do we use Regular Expressions in Checkpoints?
When creating a standard checkpoint to verify the property values of an object, we can set the expected
value of an objects property as a regular expression so that an object with a varying value can be
verified. For example, suppose we want to check that every window and dialog box in our application
contains the name of our application followed by a hyphen (-) and a descriptive title. We can add a
checkpoint to each dialog box object in our test to check that the first part of the title contains the name of
our application followed by a hyphen.
<<<<<< =================== >>>>>>
Q. 164: What are the values for which we can define the regular expression?
We can define a regular expression for a constant value, a Data Table parameter value, an Environment
parameter value, or a property value in a programmatic description.
<<<<<< =================== >>>>>>
Q. 165: What is the purpose of including Programming Statements in Tests?
We add steps which contain programming logic to the recorded framework just to increase the power and
flexibility of the testing process.
<<<<<< =================== >>>>>>
Q. 166: What are the contents of the Programming Statements used in tests?
Programming statements usually contain:
1) Recordable test object methods: These are operations that a user can perform on an application.
2) Non-recordable test object methods: These are operations that users cannot perform on an
application. We use these methods to retrieve or set information, or to perform operations triggered by an
event.
3) Run-time methods of the object being tested.
4) Various VBScript programming commands that affect the way the test runs, such as conditions and
loops. These are often used to control the logical flow of a test.
5) Supplemental statements, such as comments, to make our test easier to read, and messages that
appear in the test results, to alert us to a specified condition.
<<<<<< =================== >>>>>>
Q. 167: How can we increase the Readability of our Tests?
We can improve the readability of our test using With statements. We can instruct QTP to automatically
generate With statements as we record. But even after our basic test is recorded, we can convert its
statements, in the Expert View, to With statementsby selecting a menu command.
<<<<<< =================== >>>>>>
Q. 168: What is the use of Transaction Statement?

With the help of transaction statements we can measure the time i.e how long it takes certain parts of our
test to run.
<<<<<< =================== >>>>>>
Q. 169: What steps can be defined in Step Generator?
1) Test object methods and properties
2) Utility object methods and properties
3) Calls to library functions, VBScript functions, and internal script functions
<<<<<< =================== >>>>>>
Q. 170: How can we incorporate decision-making into the tests?
We can control the flow of our test with conditional statements. Using conditional IfThenElse
statements, we can incorporate decision-making into our tests. The IfThenElse statement is used to
evaluate whether a condition is true or false and, depending on the result, to specify one or more
statements to run. Usually the condition is an expression that uses a comparison operator to compare
one value or variable with another.
<<<<<< =================== >>>>>>
Q. 171: How can we do the nesting of IfThenElse statement?
The IfThenElse statement can be nested to as many levels as you need. It has the following syntax:
If condition Then statements
[Else elsestatements]
End If
Or, we can use the block form syntax:
If condition Then [statements]
[ElseIf condition-n Then [elseifstatements] .
[Else
[elsestatements]
End If
<<<<<< =================== >>>>>>
Q. 172: What is the use of Looping Statements?
We can control the flow of our test with loop statements. Using loop statements, we can run a group of
steps repeatedly, either while or until a condition is True. We can also use loop statements to repeat a
group of steps a specific number of times.
<<<<<< =================== >>>>>>
Q. 173: What type of Loop Statements are available in Keyword View?
1) WhileWend. Performs a series of statements as long as a specified condition is True.
2) ForNext. Uses a counter to perform a group of statements a specified number of times.
3) DoWhile. Performs a series of statements indefinitely, as long as a specified condition
is True.
4) DoUntil. Performs a series of statements indefinitely, until a specified condition
becomes True.
<<<<<< =================== >>>>>>
Q. 174: What is the purpose of having comments in the tests?
A comment is an explanatory remark in a program. When we run a test, QTP does not process
comments. We can use comments to explain sections of our tests to improve readability and to make
them easier to update. While editing our test, we can directly add comments in the Keyword View or in
the Expert View. We can also add comments to function libraries. We can modify comments at any time
directly in the Keyword View or the Expert View, or using the Comment Properties dialog box.
<<<<<< =================== >>>>>>
Q. 175: How can we add the same comment to every action that we create?
We can add the same comment to every action that we create, by adding the comment to an action
template.
<<<<<< =================== >>>>>>
Q. 176: What is Synchronization of Tests in QTP?
Synchronization activity in the test ensures that QTP waits until our application is ready before performing
a certain step. This is helpful in handling anticipated timing problems like: When we run a test, our
application may not always respond with the same speed. For example, it might take a few seconds:
1) For a progress bar to reach 100%

2) For a status message to appear


3) For a button to become enabled
4) For a window or pop-up message to open
<<<<<< =================== >>>>>>
Q. 177: What is a Synchronization Point in QTP?
A synchronization point, instructs QTP to pause the test until an object property achieves the value we
specify. When we insert a synchronization point into our test, QTP generates a WaitProperty statement in
the Expert View.
<<<<<< =================== >>>>>>
Q. 178: What are the ways by which we can make QTP to wait?
1) By inserting a synchronization point.
2) By inserting Exist or Wait statements that instruct QTP to wait until an object exists or to wait a
specified amount of time before continuing the test.
3) By modifying the default amount of time that QTP waits for a Web page to load.
4) By increasing the default timeout settings for a test to instruct QTP to allow more time for objects to
appear.
<<<<<< =================== >>>>>>
Q. 179: What is the purpose of creating Synchronization Points in QTP?
If we do not want QTP to perform a step or checkpoint until an object in our application achieves a certain
status, we should insert a synchronization point to instruct QTP to pause the test until the object property
achieves the value we specify or until a specified timeout is exceeded. For example, suppose we record a
test on a flight reservation application. We insert an order, and then we want to modify the order. When
we click the Insert Order button, a progress bar is displayed and all other buttons are disabled until the
progress bar reaches 100%. Once the progress bar reaches 100%, we record a click on the Update
Order button.
<<<<<< =================== >>>>>>
Q. 180: What happens if we dont use Synchronization Point in QTP?
Without a synchronization point, QTP may try to click the Update Order button too soon during a test run
if the progress bar takes longer than the tests object synchronization timeout, and the test will fail.
<<<<<< =================== >>>>>>
Q. 181: What is the purpose of Expert View in QTP?
In QTP, tests are composed of statements coded in the Microsoft VBScript programming language. The
Expert View provides an alternative to the Keyword View for testers who are familiar with VBScript. In the
Expert View, we can view an action in VBScript. If we are familiar with VBScript, we can add and update
statements and enhance our tests and function libraries with programming. This enables us to increase a
tests power and flexibility.
<<<<<< =================== >>>>>>
Q. 182: What is the main difference between Keyword View & The Expert View in QTP?
1) In the Keyword View, QTP displays information about each step and shows the object hierarchy in an
icon-based table.
2) In the Expert View, QTP displays each step as a VBScript line or statement. In object- based steps, the
VBScript statement defines the object hierarchy. In the Expert View, an objects description is displayed in
parentheses following the object type.
<<<<<< =================== >>> >>>
Q. 183: How can we insert a checkpoint or output value statement in Expert View Manually?
Because the statement displayed in the Expert View is a reference to the stored information, hence we
cannot insert a checkpoint or output value statement in the Expert View manually and we cannot copy a
Checkpoint or Output statement from the Expert View to another test.
<<<<<< =================== >>>>>>
Q. 184: What are the various ways of generating Statements in Expert View?
We can generate statements in the following ways:
1) We can use the Step Generator to add steps that use methods and functions.
2) We can manually insert VBScript statements that use methods to perform operations.
3) When we start to type a VBScript keyword in the Expert View or a function library, QTP automatically
adds the relevant syntax or blocks to our script, if the Auto-expand VBScript syntax option is enabled.
<<<<<< =================== >>>>>>

Q. 185: What is IntelliSense in QTP?


IntelliSense is a statement completion feature of QTP which helps us in selecting the test object, method,
property, or collection for our statement and to view the relevant syntax as we type in the Expert View or
a function library.
<<<<<< =================== >>>>>>
Q. 186: What is the purpose of Auto-expand VBScript syntax option in QTP?
Auto-expand VBScript syntax is an option available in QTP. When this option is enabled and we start to
type a VBScript keyword in the Expert View or a function library, QTP automatically recognizes the first
two characters of the keyword and adds the relevant VBScript syntax or blocks to the script. For example,
if we enter the letters if and then enter a space at the beginning of a line, QTP automatically enters:
If Then
End If
The Auto-expand VBScript syntax option is enabled by default.
<<<<<< =================== >>>>>>
Q. 187: What is the purpose of bookmarks in our Test Actions?
We can use bookmarks to mark important sections in our action or function library so that we can
navigate between the various parts more easily. In tests, bookmarks apply only within a specific action;
they are not preserved when we navigate between actions and they are not saved with the test or
function library.
<<<<<< =================== >>>>>>
Q. 188: What is the meaning of error message Expected end of statement while running a test?
When we receive an Expected end of statement error message while running a step in our test or
function library, it may indicate that we need to add parentheses around the arguments of the steps
method.
<<<<<< =================== >>>>>>
Q. 189: What are the types of Programmatic Descriptions?
1) Static Programmatic Description: Here we list the set of properties and values that describe the object
directly in a VBScript statement. Using the Static type to enter programmatic descriptions directly into our
statements may be easier for basic object description needs.
2) Dynamic Programmatic Description: Here we add a collection of properties and values to a Description
object, and then enter the Description object name in the statement. In most cases, using the Dynamic
type provides more power, efficiency, and flexibility.
<<<<<< =================== >>>>>>
Q. 190: How can we retrieve all objects located inside a Parent Object?
We use the ChildObjects method to retrieve all objects located inside a specified parent object, or only
those child objects that fit a certain programmatic description. To retrieve this subset of child objects, we
first create a description object and add the set of properties and values that we want our child object
collection to match using the Description object.
<<<<<< =================== >>>>>>
Q. 191: What is the advantage of using Index Property in Programmatic Descriptions?
The index property is quite useful test object property for uniquely identifying an object. The index test
object property identifies an object based on the order in which it appears within the source code, where
the first occurrence is 0. Index property values are object-specific.
<<<<<< =================== >>>>>>
Q. 192: How can we run standard DOS commands in QTP tests?
We can run standard DOS commands in our QTP test or function using the VBScript Windows Scripting
Host Shell object (WSCript.shell). For example, we can open a DOS command window, change the path
to C:\, and run the DIR command using the following statements:
Dim oShell
Set oShell = CreateObject (WSCript.shell)
oShell.run cmd /K CD C:\ & Dir
Set oShell = Nothing
<<<<<< =================== >>>>>>
Q. 193: What is the advantage of having User-Defined Functions?
If we have segments of code that we need to use several times in our tests, we create a user-defined
function. A user-defined function encapsulates an activity (or a group of steps that require programming)

into a keyword. By using user-defined functions, our tests become shorter, and easier to design, read,
and maintain. We can then call user-defined functions from an action by inserting the relevant keywords
into that action.
<<<<<< =================== >>>>>>
Q. 194: What is a Function Library?
A function library is a Visual Basic script containing VBscript functions, subroutines, modules, and so
forth.We can use QTP to modify and debug any existing function libraries (such as .vbs or .txt files). Using
QTP, we can define and store our user-defined functions in a function library (saved as a .qfl file, by
default)
<<<<<< =================== >>>>>>
Q. 195: What are the modes available to open a function library?
We can open a function library, only if you have read or read-write permissions for the file. We can open a
function library in following two modes:
1) Edit Mode: Enables us to view and modify the function library. While the function library is open on our
computer, other users can view the file in read-only mode, but they cannot modify it.
2) Read-only mode: Enables us to view the function library but not modify it. By default, when we open a
function library that is currently open on another computer, it opens in read-only mode.
We can also open a function library in read-only mode if we want to review it, but we do not want to
prevent another user from modifying it.
<<<<<< =================== >>>>>>
Q. 196: How can we debug a Function Library?
Before we can debug a function library, we must first associate it with a test and then insert a call to at
least one of its functions. For example, we can use the Debug Viewer to view, set, or modify the current
value of objects or variables in our function library. We can step into all the functions, set breakpoints,
stop at breakpoints, view expressions, and so forth. We can begin debugging from a specific step, or we
can instruct QTP to pause at a specific step.
<<<<<< =================== >>>>>>
Q. 197: What is Function Definition Generator?
Function Definition Generator is a feature of QTP, which enables us to generate definitions for new userdefined functions and add header information to them. We can then register these functions to a test
object, if needed. We fill in the required information and the Function Definition Generator creates the
basic function definition for us. After we define the function definition, we can insert the definition in our
function library and associate it with our test, or we can insert the definition directly in a test script in the
Expert View. Finally, we complete the function by adding its content i.e. code.
<<<<<< =================== >>>>>>
Q. 198: What methodology QTP follows while running the tests?
If our test contains a global Data Table parameter, QTP runs the test once for each row in the Data Table.
If our test contains a Data Table parameter for the current action data sheet, QTP runs the action once for
each row of data in that action data sheet. We can also specify whether to run the first iteration or all
iterations, for the entire test or for a specific action in the test; or to run the iterations for a specified range
of data sets. We can run the entire test from the beginning, or we can run part of it. We can designate
certain steps as optional, to enable QTP to bypass them instead of aborting the run if these steps do not
succeed.
<<<<<< =================== >>>>>>
Q. 199: How can we do part running of the test?
We can use the Run from Step option to run a selected part of our test. This enables us to check a
specific section of our application or to confirm that a certain part of our test runs smoothly. With this
option the test is run from the Expert View & test is made to run from the selected step until the end of the
action. Using Run from Step in this mode ignores any iterations.
<<<<<< =================== >>>>>>
Q. 200: What are Optional Steps in testing?
An optional step is a step which is not required to successfully complete a run session. For example,
suppose that when recording a test, the application we are testing prompts us to enter a user name and
password in a login window. When we run the test, however, the application does not prompt us to enter
our user name and password because it retained the information that was previously entered. In this

case, the steps that were recorded for entering the login information are not required and should,
therefore, be marked optional.
<<<<<< =================== >>>>>>
201) What are the different String functions in QTP?
String functions to extract the part of the string left - gets the specified number of characters from the left side of string
mid - gets the specified number of characters from the given position of the string
right - gets the specified number of characters from the right side of string
String functions to remove the spaces from the string ltrim - removes the blank spaces from the left side of the string
rtrim - removes the blank spaces from the right side of the string
trim - removes the blank spaces from the left and right side of the string
Other String functions String
- Returns a string of the given length with specified character.
Space - Returns the empty string with given length
strReverse - Reverses the given string
ucase
- Converst the string to upper case
lcase
- Converts the string to lower case
strComp - Compares 2 strings
replace - replaces the given string str1 from input string say str with other string say str2
len gets the number of characters in given string
split - splits the string into array using given delimiter
join - forms the string from given array elements
cstr - converts the data type of the variable into String
chr gets the character corresponding to the given ascii value
Asc - gets the ascii value of the given character.
instr - searches for a substring in a given string and returns the position where the match is found.
InStrRev- searches for a substring in a given string and returns the position where the match is found
from the end of the string.
<<<<<< =================== >>>>>>
202) 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
<<<<<< =================== >>>>>>
203) Does QTP run in any environment?
No, QTP works only in the windows environment.
<<<<<< =================== >>>>>>
204) 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.
<<<<<< =================== >>>>>>
205) What is QTPs 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
<<<<<< =================== >>>>>>
206) 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, conditionsetc)
<<<<<< =================== >>>>>>
207) 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
<<<<<< =================== >>>>>>
208) What are the different recording modes and how do they work?
QTP provides 3 modes of recording:
Normal Recording mode The default recording method is always the normal mode. This method uses
the model of Test Objects and Runtime objects to learn and act on the AUT.
Analog recording mode records the exact mouse and key strokes that the user performs in relation to
either the screen or AUT window. The steps that are recorded using this method cannot be edited. The
way this usually gets represented in a code is:
Window/app.RunAnalog Track1
One scenario in which this type of recording can be used is when we are trying to capture a signature.
Low Level recording mode This mode records the co-ordinates in the application where the operation
is performed, irrespective of whether QTP recognizes the specific Object or Operation.
209) Which recording modes need more memory?
Analog and Low-level recording modes
<<<<<< =================== >>>>>>
210) 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
<<<<<< =================== >>>>>>
211) Does Low level recording capture mouse movements?
No. Mouse movements are not captured.
<<<<<< =================== >>>>>>
212) How does QTP identify an object?
QTP has a predetermined set of properties that it learns/stores for every class of object it identifies. There
are 3 aspects to this:

Mandatory properties: This is the list of properties for a certain class that QTP always stores. We
could say that this is the object description. It also checks this in conjunction with the parent object to see
if the description is sufficient to identify the object uniquely.

Assistive properties: In case the description of mandatory properties is insufficient to identify the
Object a set of non-mandatory properties will be added to the description one after the other until there is
enough data to identify the object.

Ordinal Identifier: If the assistive properties also do not result in unique identification of an object
a special ordinal identifier is added by QTP, such as the objects location on the page or in the source
code.
<<<<<< =================== >>>>>>
213) 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.
<<<<<< =================== >>>>>>
214) 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.
<<<<<< =================== >>>>>>
215) What is an object repository?
OR is like a warehouse where all the objects in a test are stored. OR has the list of Objects that QTP
learned during the record process and the class to which they belong. It stores the set of properties that
uniquely identifies the Object (description) and also names the object for the sake of identification in our
test, based on its most prominent feature.
<<<<<< =================== >>>>>>
216) 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.
<<<<<< =================== >>>>>>
217) An action has both shared and local OR associated to it and both have the same object in them. In
the test which one will be considered?
If a local OR and Shared OR have an object with the same name, the action will consider the object in its
local OR.
<<<<<< =================== >>>>>>
218) 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 ORs associated to the same action. If Shared OR1 and Shared
OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the
shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the
OBJ1 from Shared OR1 will be taken into account.
<<<<<< =================== >>>>>>
219) 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.
<<<<<< =================== >>>>>>
220) 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
<<<<<< =================== >>>>>>
Q. 221: Tell me briefly about QTP?
QTP is a graphical interface record-playback automation tool. It is able to work with any web, Java or
windows client application. QTP enables you to test standard web objects and ActiveX controls. In
addition to these environments, QTP also enables you to test Java applets and applications and
multimedia objects on Applications as well as standard Windows applications, Visual Basic applications
and .NET framework applications...
QTP is Mercury Interactive Functional Testing Tool.
Mercury QTP 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 QTPs 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.
QTP enables you to test standard Windows applications, Web objects, ActiveX controls, and Visual Basic
applications. You can also acquire additional QTP add-ins for a number of special environments (such as
Java, Oracle, SAP Solutions, .NET Windows and Web Forms, Siebel, PeopleSoft, Web services, and
terminal emulator applications).
<<<<<< =================== >>>>>>
Q. 222: Whats the basic concept of QTP?
QTP is based on two concepts like:
a) Recording
b) Playback
<<<<<< =================== >>>>>>
Q. 223: Which scripting language used by QTP?
QTP uses VB scripting.
<<<<<< =================== >>>>>>
Q. 224: How many types of recording facility are available in QTP?
QTP provides three types of recording methods like:
a) Context Recording (Normal)
b) Analog Recording
c) Low Level Recording
<<<<<< =================== >>>>>>
Q. 225: How many types of Parameters are available in QTP?
QTP provides three types of Parameters like:
a) Method Argument
b) Data Driven
c) Dynamic
<<<<<< =================== >>>>>>
Q. 226: Whats the testing process in QTP?
QTP testing process consist of seven steps like:
1) Preparing to recording
2) Recording
3) Enhancing your script
4) Debugging
5) Run
6) Analyze
7) Report Defects etc.
<<<<<< =================== >>>>>>
Q. 227: How to Start recording using QTP?

Choose Test > Record or click the Record button.


When the Record and Run Settings dialog box opens, to do this;
1) In the Web tab, select Open the following browser when a record or run session begins.
2) In the Windows Applications tab, confirm that Record and run on these applications (opened on
session start) is selected, and that there are no applications listed.
<<<<<< =================== >>>>>>
Q. 228: How to insert checkpoints to an image to check enable property in QTP?

Answer - 1: If all images are like push button than you can check the property enabled or disabled. If you
are not able to find that property than go to object repository for that object and click on add remove to
add the available properties to that object. And if you take it as image than you need to check visible or
invisible property, there are no enable or disable properties for the image object.
Answer - 2: The Image Checkpoint does not have any property to verify the enable/disable property.
important aspects that needs to be checked are:
a) Find out form the Developer if he is showing different images for activating/deactivating i.e. grayed
out image. That is the only way a developer can show deactivate/activate if he is using an "image". Else
he might be using a button having a heads-up with an image.

b) If it is a button used to display with the heads-up as an image you would need to use the object
Properties as a checkpoint.
<<<<<< =================== >>>>>>
Q. 229: How to save your test using QTP?

Select File > Save or click the Save button. The Save dialog box opens to the Tests folder. Create a folder
which you want to save to, select it, and click Open. Type your test name in the File name field. Confirm
that Save Active Screen files is selected. Click Save. Your test name is displayed in the title bar of the
main QTP window.
<<<<<< =================== >>>>>>
Q. 230: How to Run a Test using QTP?

Step-1: Start QTP and open your test.


If QTP is not already open, choose Start > Programs > QuickTest Professional > QuickTest Professional.
# If the Welcome window opens, click Open Existing.
# If QTP opens without displaying the Welcome window, choose File > Open or click the Open button.
In the Open Test dialog box, locate and select your test, then click Open.
Step-2: Confirm that all images are saved to the test results.
QTP allows you to determine when to save images to the test results.
Choose Tools > Options and select the Run tab. In the Save step screen capture to test results option,
select Always. Click OK to close the Options dialog box.
Step-3: Start running your test.
Click Run or choose Test > Run. The Run dialog box opens. Select New run results folder. Accept the
default results folder name. Click OK to close the Run dialog box.
<<<<<< =================== >>>>>>
Q. 231: How to open a new test using QTP?

1) If QTP is not currently open: Choose Start > Programs > QuickTest Professional > QuickTest
Professional. If the Welcome window opens, click Blank Test. Otherwise, choose File > New, or click the
New button. A blank test opens.
2) If QTP is already open :Check which add-ins are loaded by selecting Help > About QuickTest
Professional. If the Web Add-in is not loaded, you must exit and restart QTP. When the Add-in Manager
opens, select the Web Add-in, and clear all other add-ins. Choose File > New, or click the New button. A
blank test opens.
<<<<<< =================== >>>>>>

Q. 232: How to do load testing for web based Application?


1) Recording a scenario in QTP of web based application.
2) Make 100 copies of that scenario and run the test (scenario run for 100 times)
3) In that case, do the load of application on server.
4) The basic logic of running the copy 100 times is to create same scenario as if 100 users were working.
<<<<<< =================== >>>>>>
Q. 13: What is the extension of script and object repository files?
Object Repository : .tsr , Script : .mts, Excel : Default.xls
<<<<<< =================== >>>>>>
Q. 14: How to suppress warnings from the "Test results page"?
From the Test results Viewer "Tools > Filters > Warnings"...must be "Unchecked".
<<<<<< =================== >>>>>>
Q. 15: When we try to use test run option "Run from Step", the browser is not launching automatically
why?
This is default behavior.
<<<<<< =================== >>>>>>
Q. 16: What's the role of Checkpoints in QTP?

A checkpoint verifies that expected information is displayed in your application while the test is running.
Checkpoint is basically a point in the test, which validates for truthfulness of a specific thing 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....
<<<<<< =================== >>>>>>
Q. 17: What types of checkpoints are offered by QTP?
There are 10 types of checkpoints you can insert in QTP:
1) 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.
2) Image Checkpoint checks the value of an image in your application or Web page. For example, you
can check that a selected images source file is correct.
3) Bitmap Checkpoint checks an area of your Web page or application as a bitmap.
4) Table Checkpoint checks information within a table. For example, suppose your application or Web
site contains a table listing all available flights from one place to another. You can add a table checkpoint
to check that the time of the first flight in the table is correct.
5) Text Checkpoint checks that a text string is displayed in the appropriate place in your application or
on a Web page.
6) Text Area Checkpoint checks that a text string is displayed within a defined area in a Windows
application, according to specified criteria.
7) Accessibility Checkpoint identifies areas of your Web site that may not conform to the World Wide
Web Consortium (W3C) Web Content Accessibility Guidelines.
8) 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.
9) Database Checkpoint checks the contents of a database accessed by your application.
10) XML Checkpoint checks the data content of XML documents in XML files or XML documents in Web
pages and frames.
<<<<<< =================== >>>>>>
Q. 18: How to add a standard checkpoint in your test?
1) Start QTP and open your test. In the Open Test dialog box, locate and select your test, then click
Open.
2) Save the test as Checkpoint. Select File > Save As. Save the test as Checkpoint.
3) Confirm that the Active Screen option is enabled. If you do not see the Active Screen at the bottom of
the QTP window, click the Active Screen button, or choose View > Active Screen.
4) Locate the page where you want to add a standard checkpoint.
5) Create a standard checkpoint. In the Active Screen, right-click element in your application and choose
Insert Standard Checkpoint.
6) Save the test.
<<<<<< =================== >>>>>>
Q. 19: How to add a page checkpoint to your test?
The page checkpoint checks that the number of links and images in the page when you run your test is
the same as when you recorded your test.
1) Locate the page where you want to add a page checkpoint.
2) Create a page checkpoint. Right-click anywhere in the Active Screen, and choose Insert Standard
Checkpoint. The Object Selection - Checkpoint Properties dialog box opens. Note that this dialog box
may include different elements, depending on where you click in the Active Screen.
3) Save the test.
<<<<<< =================== >>>>>>

Q. 20: How run time data (Parameterization) is handled in QTP?


You can 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.
1) Can we update an Object Repository parameter at run-time?
You can set or retrieve the value of repository parameters using the Repository object [An object that
enables you to work with repository parameters.]. All changes made to repository parameters using the
Repository object are temporary, and are valid only for the current run session.
In order to set the value of a repository parameter use:
Repository (RepositoryParameterName) = NewValue
In order to retrieve the value of an existing repository parameter use:
CurrentValue = Repository (RepositoryParameterName)
2)Which is better - Local Object Repository or Shared Object Repository?
Both Local Object Repository and Shared Object Repository are used in different situations:
Local Object Repository should be used when:
You are creating single-action tests. You are creating simple tests, especially under the following
conditions:
1.You have only one, or very few, tests that correspond to a given application, interface, or set of
objects.
2.You do not expect to frequently modify object properties.
3.You are new to using QuickTest. You can record and run tests without creating, choosing, or modifying
shared object repositories because all objects are automatically saved in a local object repository that
can be accessed by its corresponding action.
Shared Object Repository should be used when:
1.You are creating tests using keyword-driven methodologies (not by recording).
2.You have several tests that test elements of the same application, interface, or set of objects.
3.You often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to
Action options.
4.You expect the object properties in your application to change from time to time and/or you regularly
need to update or modify object properties.
5.If you are familiar with testing, it is probably most efficient to save objects in a shared object
repository. In this way, you can use the same shared object repository for multiple actionsif the
actions include the same objects.
6.Object information that applies to many actions is kept in one central location. When the objects in
your application change, you can update them in one location for all the actions that use this shared
object repository.
3)Can you merge 2 object repositories in QTP
YES - you can merge 2 repositories in qtp using object repository manager.
Merging local to shared repository.
You would need to associate the shared repository with the action containing the local repository. Go to
"object repository manager - update from local repository" option.
Follow these steps to merge 1. Go to resources -> object repository manager.
2. In the object repository manager window, go to file -> open, and select the shared object repository
file. Clear the open in read-only mode checkbox.
3. If the repository file opened in read-only mode, go to file -> enable editing.
4. Go to tools -> update from local repository.

Merging shared repositories


1. Open the object repository manager.
2. Go to tools -> object repository merge tool.
3. In the new merge window, browse to the primary repository file. Select the secondary repository file.
4. Click ok
5. Review the merge statistics, as described in viewing merge statistics, and resolve any merge conflicts
that were reported.
4)How would you load an Object Repository at run time?
Using "Add" Method of RepositoriesCollection, as this adds an object repository file to the specified
index position in the run-time collection of shared object repository files associated with the current
action.
Syntax:
RepositoriesCollection.Add RepositoryPath [, Position]
RepositoryPath is the absolute or relative path of the shared object repository that you want to add and
Position Number is the index position to which you want to add the shared object repository in the runtime list of associated shared object repositories. If you do not specify a position, the object repository is
added to the end of the list (position = -1).
5) Different type of Object Properties ?
a)Mandatory Properties are properties that QuickTest always learns for a particular test object
class.
b)Assistive properties are properties that QuickTest learns only if the mandatory properties that
QuickTest learns for a particular object in your application are not sufficient to create a unique
description. If several assistive properties are defined for an object class, then QuickTest learns one
assistive property at a time and stops as soon as it creates a unique description for the object. If
QuickTest does learn assistive properties, those properties are added to the test object description.
c)An ordinal identifier assigns a numerical value to a test object that indicates its order or
location relative to other objects with an otherwise identical description (objects that have the same
values for all properties).
You can select 3 types of ordinal identifiers
o Location. Indicates the order in which the object appears within the parent window, frame, or
dialog box relative to other objects with an otherwise identical description.
o Index. Indicates the order in which the object appears in the application code relative to other
objects with an otherwise identical description.
o Creation Time (Browser objects only). Indicates the order in which the browser was opened
relative to other open browsers with an otherwise identical description. This identifier type is only
available if more than one Browser object was open when the test object was learned.

A Real life Example


Consider yourself as the Automation developer, myself as QTP and a parking lot as the application, cars
parked in the parking area as the Test Objects.
Now you ask me (QTP) to bring a car from the parking lot and you point me to the car ( This is adding the
Test Object to Object repository or recording on the same). By my previous knowledge and what I am
programmed to learn, I look at the car and remember its # plate so that I can identify the same in future.

The color of the car is red but I dont remember this as # plate (My mandatory property settings) is good
enough for me to recognize. This is about learning mandatory properties
Now if I add color property to Mandatory list I will have 2 properties for identifying the car. If the car is
painted to white color I would not be able to locate the car as I am still looking for a red color car with
the same # plate as the white one in front of me. So this is why we dont add all properties to
Mandatory list
Now let assume this parking lot has some new cars which has no # plates. So my mandatory properties
doesnt give me anything to re-identify the car later. I start looking at my assistive properties which is
the color in this case. The parking lot has only 1 red car so I remember the color as well to re-identify the
car. This is about learning assistive properties. If one assistive property doesnt help I would look at
others one by one.
So far so good. Now if we have another red car parked in the parking, so my identification of blank
#plate and red color will still not resolve which car to pick. So I need to make a choice based on 1st or
the 2nd one (index), left one or the right one (location), the car that came first in the parking lot or the
one came later (creationtime in case of browser). This is where we need ordinal identifier
Now coming to smart identification. Consider you told me to pick a red color car with some plate #X and
car was repainted to white. Now I dont find anything in the lot and I start getting smart. I would say lets
just drop off all what you said and see if I can find the car. I first see how many cars in the lot, If there is
only 1 then my issue is solved. But lets say there are 3 cars, Now my SI algo says to look for the #plate
and i find that white car matches the # plate so I pick it up and the car for you. This is what is Smart
Identification
If my Smart identification had color as the first property to be checked then I would have looked only at
white car present in the parking lot, if I found one I would give the same to you. Even though our car
may not be present in the parking lot I still give you a car which may not be the one you were looking
for. This is why it always advised to keep Smart Identification disabled.
Coming back to the QTP world I would like to highlight another point now. Mandatory, Assistive
properties only come into picture when we add an object to the OR or record some action on the same.
While identifying the object again QTP will not differentiate which property was a Mandatory one or
Assistive one. It would just try to match all the properties it had been given to identify the object.
There is a small difference when it comes to ordinal identifiers. QTP only uses ordinal identifiers when
there are multiple matches of an object. So Browser(creationtime:=100?) is same as
Browser(micclass:=Browser) when you only have one browser open as QTP will not use the
Creationtime property at all. But when 2 browsers exist QTP will throw an error as there is none with
creationtime:=100
I hope this cleared all doubts about the
6)What are GET TO, SET TO and GET RO properties in QTP?
GetTOProperties:
- Returns properties and values which QTP has recorded and will use to identify an object at run time.

- It will Return the value of a particular property for a test object which QTP recorded to identify an
object during Run time. The value is taken from the Object Repository.
- Retrieves the values of only those properties that are included in the test object description in Object
Repository by QTP.

GetROProperty:
- It will Return the current value (run time value) of the test object property from the object in the
application.
- Retrieves the current property value of the object in the application during the test run.
SetTOProperty:
You can modify the properties of the temporary version of the object during the run session without
affecting the permanent values in the object repository by adding a SetTOProperty statement in the
Expert View.
Use the following syntax for the SetTOProperty method:
Object(description).SetTOProperty Property, Value
'This will return the name property value of Google Search editbox ("q")
msgbox Browser("Google").Page("Google").WebEdit("q").GetTOProperty("name")
'This will set the property value.
Browser("Google").Page("Google").WebEdit("q").SetToProperty "name","GoogleSearchBox"
'This will validate the changes that we have made to the name property
msgbox Browser("Google").Page("Google").WebEdit("q").GetTOProperty("name")
Pls check out the property of Web edit before and after the execution (It will be the same in OR).
7) How to add object repositories at runtime?
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Open "C:\Tests\Test1", False, False ' Open a test
Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories ' Get the object repositories
collection object of the "Login" action
qtRepositories.Add "C:\MainApp.tsr", 1 ' Add the repository to the collection

8)Types of Automation Framework


These are very popular definition of different types of frameworks available in the market
Script Modularity Framework
The test script modularity framework requires the creation of small, independent scripts that
represent modules, sections, and functions of the application-under-test. These small scripts are then
used in a hierarchical fashion to construct larger tests, realizing a particular test case.
Library Architecture Framework

The test library architecture framework is very similar to the test script modularity framework
and offers the same advantages, but it divides the application-under-test into procedures and functions
instead of scripts. This framework requires the creation of library files that represent modules, sections,
and functions of the application-under-test. These library files are then called directly from the test case
script.
Keyword-Driven or Table-Driven Testing Framework
Keyword-driven testing and table-driven testing are interchangeable terms that refer to an
application-independent automation framework. This framework requires the development of data
tables and keywords, independent of the test automation tool used to execute them and the test script
code that "drives" the application-under-test and the data. Keyword-driven tests look very similar to
manual test cases. In a keyword-driven test, the functionality of the application-under-test is
documented in a table as well as in step-by-step instructions for each test.
Data-Driven Testing Framework
Data-driven testing is a framework where test input and output values are read from data files
(datapools, ODBC sources, cvs files, Excel files, DAO objects, ADO objects, and such) and are loaded into
variables in captured or manually coded scripts. In this framework, variables are used for both input
values and output verification values. Navigation through the program, reading of the data files, and
logging of test status and information are all coded in the test script.
Hybrid Test Automation Framework
The most commonly implemented framework is a combination of all of the above techniques,
pulling from their strengths and trying to mitigate their weaknesses. This hybrid test automation
framework is what most frameworks evolve into over time and multiple projects.

9)Error Handling & Recovery Scenario


Recovery Scenario:
When executing scripts we may get some Unexpected errors.To recover the test and continue running
script from these unexpected errors we use Recovery Scenarios.
What happens in Recovery Scenarios?
A recovery scenario consists of the following:
Trigger Event:
The event that interrupts your run session. For example a window that may pop up on screen.
Recovery Operations:
The operations to perform to enable QTP to continue running the test after the trigger event interrupts
the run session. For example, clicking an OK button in a pop-up window.
Post-Recovery Test Run Option:
The instructions on how QTP should proceed after the recovery operations have been performed, and
from which point in the test QTP should continue. For example, you may want to restart a test from the
beginning, or skip a step entirely and continue with the next step in the test. Recovery scenarios are
saved in recovery scenario files having the extension .qrs. A recovery scenario file is a logical collection
of recovery scenarios, grouped according to our specific requirements.
Recovery scenario manger can handle following four events:
1. Pop-up window: To handle unwanted pop ups.
2. Object state: To handle object related errors at runtime.
3. Test run error: To handle vb script statement errors at runtime.

4. Application crash: To handle crashed applications at runtime.


10)When to use Error handling(on error resume next) vs Recovery Scenarios ?
If you can predict that a certain event may happen at a specific point in your test or component,
it is recommended to handle that event directly within your test or component by adding steps such as
If statements or optional steps or "on error resume next", rather than depending on a recovery scenario.
Using Recovery Scenarios may result in unusually slow performance of your tests.They are designed to
handle a more generic set of unpredictable events which CANNOT be handled programmatically.
Example:
A recovery scenario can handle a printer error by clicking the default button in the Printer Error
message box.You cannot handle this error directly in your test, since you cannot know at what point the
network will return the printer error. You could try to handle this event in your test by adding an If
statement immediately after the step that sent a file to the printer, but if the network takes time to
return the printer error, your test may have progressed several steps before the error is displayed.
Therefore, for this type of event,only a recovery scenario can handle it.
On error Statements
Following are error statements :
1. On Error Resume Next
2. On Error Go to 0
3. err.number
4. err.description
On Error Resume Next:
On Error Resume Next statement enables the Error handling in the code.If there is error in the
code "On error Resume Next" ignores it and continue with next line of code.
On Error Go to 0:
On error got to 0 statement disables error handling we have previiously enabled it by using On
Error resume Next.
err.number and err.description:
Provides the error number and the description of the error
11)Checkpoints
Checkpoint enables user to identify whether AUT is correctly working or not by comparing
current value of a particular property with expected value of that property.

Types of Checkpoints in QTP:

1 .Standard check point


2 .Bit map check point
3 .Text check point
4 .Text area check point
5 .Data base check point
6. XML Check point
7. Table checkpoint
8. Image checkpoint
9. Page check point
10. Accessibility check point

12)Types of DataTable:
Design Time DataTable: While creating editing the test scripts, you enter data directly in the
data table displayed there. You can view data table by selecting View >> Data Table option. This data
table is called Design Time DataTable.
Runtime DataTable: The data table used while running the test is called Runtime DataTable. The
data in the runtime data table may be same as design time data table and/or can be entered by
importing data from excel sheet, text file etc. The runtime data table can be seen in the Test Results
window when run session is ended.

13)DataTable Object - Methods


(1) Add Sheet:
We can use this method to add one new sheet to the run time data table.
Syntax: DataTable.AddSheet "sheet name"
Ex: DataTable.AddSheet "gcreddy"
(2) Delete Sheet:
We can use this method to delete one specified sheet from the Run Time Data table.
Syntax: datatable.DeleteSheet (Sheet_ID)
Ex: datatable.DeleteSheet (3)
(3) GetSheetCount
We can use this method to count number of sheets in the run time data table.
Syntax:
datatable.GetSheetCount
msgbox datatable.GetSheetCount
(4) GetRowCount
We can use this method to count number of rows in the 1st sheet
(longest column) of the Run time data table.
Syntax: datatable.GetRowCount
Ex: msgbox datatable.GetRowCount

(5) GetSheet
We can use this method to return a specified sheet from the Run Time data table.
Syntax: datatable.GetSheet(SheetID)
Ex: msgbox datatable. GetSheet(1).GetRowCount
(6) Value
We can use this method to set or get value of cell in the specified parameter and the current
row of the Rum time data table.
To set data
Syntax: datatable.Value(Parameter_Name, Sheet_Name) = Value / variable Or
datatable(Parameter_Name, Sheet_Name) = Value / variable
To get data
Syntax: Variable = datatable.Value(Parameter_Name, Sheet_Name) Or
Variable = datatable(Parameter_Name, Sheet_Name)
Ex:
Option explicit Dim a, b, c
a=datatable.Value (1,1) b=datatable.Value (2,1) c=cint(a)+cint(b) datatable.Value (3,1) = c
Note: Default property of Datatable is value
(7) SetCurrentRow
We can use this method to take a specified row as current row in the Run Time Datatable (By
default it is 1st Row of 1st Sheet)
Syntax: datatable.SetCurrentRow(Row_Number)
g="gcreddy"
datatable.SetCurrentRow (3) datatable.Value (1,1) = g

(8) SetNextRow
We can use this method to take the row after the current Row as New Current Row in the Run
time data table.
Syntax: datatable.SetNextRow
Ex: g="gcreddy"
datatable.SetCurrentRow (3) datatable.SetNextRow datatable.Value (1,1) = g
(9) SetPrevRow
We can use this method to take the row before the current Row as New Current Row in the Run
time data table.
Syntax: datatable.SetPrevRow
Ex: g="gcreddy"
datatable.SetCurrentRow (3) datatable.SetPrevRow datatable.Value (1,1) = s
(10) Import
We can use this method to import Microsoft Excel File to the Runtime Data Table (Including all
sheets)

Syntax: datatable.Import Path of File


Ex: datatable.Import F:\Inputdata.xls
11) ImportSheet
We can use this method to import a specified sheet of Microsoft Excel Sheet to the Runtime
Data table.
Syntax: datatable.ImportSheet Path of File, Source Sheet, Destination Sheet
Ex: datatable.ImportSheet E:\gcreddy.xls,3,1
(12) Export
We can use this method to export a copy of Run Time Data table to another location (Including
all sheets)
Syntax: datatable.Export Path of File
Ex: datatable.Export F:\gcreddy.xls
13) ExportSheet
We can use this method to export a copy specified sheet of Run Time Data table to the existing
or new Excel File.
Syntax: datatable.ExportSheet Path of File, Sheet Name / Source Sheet
Ex: datatable.ExportSheet F:\gcreddy.xls, 2

14)Purpose of Global sheet & Action sheet in QTP


Global Sheet is used for Global use, that means what you
entered in global sheet that should be used in any action
in the Test for example: test1 having 4action. at that
time you want to parameterize the some object in all
actions with same Test Data. at this times used global sheet
Action Sheet is used for local use, that means if you want
to parameterize the actions individually with independent
test data in test, at that time we are use Action Sheet
15)Capture Text on an image by using QTP
Soln1.
Using QTP Bitmap CheckPoint, picture can be verified against the previously recorded picture.
Soln2.
You can use GetVisibleText method to extract text from the picture (and compare text in the
picture). This is generally used when QTP is unable to identify the particular control.
Syntax for GetVisibleText:
strText=Window(Microsoft PowerPoint).Window(Slide).WinObject(Slide).GetVisibleText
where strText = text visible on the object specified in the object hierarchy

16)Differences between Image Checkpoint and Bitmap Checkpoint in QTP.


bitmap check point is checking a particular area or part of an image..whereas Image check point
point is checking the entire window of the image
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). Note: The results of bitmap checkpoints may be affected by factors
such as operating system, screen resolution, and color settings.
17)Using QTP to capture screen shot
strFileName="c:\Googlemaps.png"
browser("name:=Google Maps").Page("title:=Google Maps").CaptureBitmap strFileName
Reporter.Reportevent mivPass,"Screenshot Capture","Screenhot Captured.",strFileName
18)Modes of Recording:
a)Normal Recording: This is the default Recording mode that records the objects and the operations
performed on the application under test.
b)Analog Recording: This records not only the keyboard actions but also the mouse movements
relative to the screen or the application window.
c)Low-Level Recording: This records the exact co-ordinates of the objects independent of the fact
whether UFT recognizes the object or NOT. It just records the co-ordinates, hence does NOT record
mouse movements.
d)Insight Recording: UFT records operation based on its appearance and NOT based on its native
properties.

18) ENVIRONMENT VARIABLE


QTP Environment variables are special type of variables whose values persist across and are shared by
all actions in a test. QTP environment variables can be used to share information across actions,
recovery scenarios and libraries.

There are 3 types of environment variables:


Built-in: QTP provides a variety of environment variables that define information such as the currently
executing test name,the tests path,operating system,its version etc..
Steps to verify the availability of built-in environment variables.
Go to File>Settings>Environment>Built-in
Accessing an Built-in environment variable in Expert View
Msgbox Environment.Value(ProductDir) It will show the folder path where the product is installed
Msgbox Environment.Value(ActionName) It will indicate which action is currently running
User defined internal: These variables are defined in a test and saved with the test.These variables can
be modified during run time.
Steps to create an user defined internal environment variable
> Go to File>Settings>Environment>Select User-defined from variable Type drop down List
> Click on add icon (+)
> Add New Environment Parameter Opens
> Provide some values in Name field(say x) and in value field (say 10')
> Click OK.
> Now Click OK on Test Settings Tab.
Accessing an User-defined internal environment variable in Expert View
Msgbox Environment.Value(X) It will display the value which we have given in value field i,e 10'
User-defined external: These variables are defined in an external environment file.These variables are
read-Only and cannot be modified during run-time.The external file can be associated with with the test
and can also be loaded at run time using LoadFromFile method.
Create an XML File
<Environment>
<Variable>
<Name>Address1</Name>
<Value>BBSR</Value>
</Variable>
<Variable>
<Name>Address2</Name>
<Value>Delhi</Value>
</Variable>
</Environment>
Steps to Create an user defined external environment variable
>Create an XML file and Save the file in a location that is accessible from the Quick Test.
>Go to File>Settings>Environment>Select User-defined from variable Type drop down List
>Select the Load Variables and values from external file Check box.
>Use the browse button or enter the full path of the XML file .
>The variables defined in the selected file are displayed in blue colour in the list of user-defined
environment variables with its Type as External.
>Click OK on Test Settings Tab.
Accessing an User-defined External environment variable in Expert View
Msgbox Environment.Value(Name) It will display the value which we have provided for the
environment variable Name

19 ) Types of object :
a) Run time object : Object present in AUT like - Buttons, Links etc
b) Test Object : Reference of Runtime object like - WinEdit, Winbutton,Link etc
c) Utility Object : Object reserved in qtp like - systemUtil,Reporter,Service,Environment
d) Automation object / User Defined Object - filesystem object , Adododb object
20) Advantage of qtp 10.0
a)New TODO and Tasks pane
QTP 10 introduce a new TODO and Task panes. The task panes can be update directly by adding
comments to the editor todo this is a task. This feature is on a script to script basis and the todo tasks
are not stored at a central location which could have been a great advantage to manage scripts updates.
b)Enhancement to Test Reporting
The inability to add images to test results (without workaround) was a big problem for various QTP
users. This problem has been solved in QTP 10 and works seamlessly well with QC integration as well.
The Reporter.ReportEvent method now takes another parameters which can be used to insert image to
the test results
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
c)Save Test with Resources
Now we can save the complete test with all its dependencies to the local system. This allows portability
of Test for debugging purposes.
d)Call Actions Dynamically
Now we can call any Action Dynamically at run-time. This was one feature which the QTP community
was waiting for long time. Though there is a workaround to call any action dynamically in earlier
versions of QTP as described in my article Dynamic Action Call Part 2
The LoadAndRunAction method allows calling any Action for Local system or Quality center at run-time.
LoadAndRunAction(TestPath, ActionName, [Iteration], [Parameters])
e)Custom Bitmap Comparison
This is another initiative from HP to allow QTP users the ability to extend the functionalities of QTP.
After Web, Java and .NET Extensibility QTP 10 now allows you to create custom Bitmap comparison
DLLs. Well the availability of KnowledgeInbox ScreenCapture and Comparison API to do the job for me I
never felt the need to explore this feature. But this can be used when you are looking at Bitmap
comparison where custom comparison needs to be done, Ex Comparing a normal image with a
watermarked version of the same image.

Q1. How to find the length of string in QTP?


Answer -You can find the length of the string using one vb script function called len.
Suppose you want to find the length of "salunke" then you will have the below statement which will
print the length of string .
print len("salunke")
Q2. How to find the current system time in QTP?
Answer - You can find the current system time using Time function in vbscript.
Print time
Q3. How to remove all spaces from given string in QTP?
Answer - We can use replace function in vbscript to remove all spaces in string.
e.g. newstring = replace(stringwithspaces," ","")
Q4. How to find the modulus of a number in QTP?
Answer - We can find the modulus of given number using MOD operator.
a = 10 mod 5
print a
Q5. How to find the size of array in QTP?
Answer - To find the size of array, we can use ubound function in QTP.
print ubound(arr) - 'prints upper bound of array.
Q6. What is the difference between byref and byval in QTP?
Answer - You can pass the parameters to function or procedure using byref or byval method.
byref will pass the address of variable but byval will pass the copy of variable. So when you want the
passed value to change, you can pass the value using byref method. Otherwise you can pass it using
byval method.
Q7. How to find the difference between 2 dates in QTP?
Answer - You can find the difference between 2 dates using datediff function. You can get the difference
in terms of minutes, seconds, hours, months or years.
Q8. How to generate the random number in given range in QTP?
Answer:
Min = 1
Max = 10
Randomize
RandomNumber = (Int((max-min+1)*Rnd+min))
Q 9. How to create an array of dictionaries in QTP?
Answer - We can create the array of dictionary like how we create array of scalar variables.
Syntax is shown below
'Declare Array with 5 elements
Dim myArray(5)
'Make first element in array as a dictionary object
Set myArray(0) = createobject("scripting.dictionary")
'Once we have a dictionary object, We can use its methods like add, remove, removeall etc
myArray(0).Add"mykey","myvalue"
'display item value of mykey in dictionary myArray(0)
print myArray(0)("mykey")

myArray(0).removeall
Q 10. How Can we store array variable in dictionary in QTP?
Answer Dim a
a = array(2,3,4,5)
Set d = createobject("Scripting.Dictionary")
d.Add "mykey", a
print d("mykey")(0)
Q 11. What is win32 API and how to use it in QTP?
Answer win32 API is an API that can be used to perform different administrative tasks. It has many WIN32
classes like Win32_Process etc.
Below Example used Win32 API in QTP to close the process by its name.
'Get the WMI object
Set WMI = GetObject("winmgmts:\\localhost\root\cimv2")
'Get collection of processes for with name pname
Set allp = WMI.ExecQuery("Select * from Win32_Process Where Name = '" & pname & "'")
'Loop through each process and terminate it
For Each p in allp
p.Terminate()
Next
This is how we can use win32 API in QTP.
How to fetch data from database in QTP
Set db = createobject("ADODB.Connection")
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=G:\priyanka\vb6\admission_project.mdb;Persist Security Info=False"
Set rst = createobject("ADODB.Recordset")
rst.Open "select * from Course ", db,3
id = rst.RecordCount
For i=0 to id-1
print rst.fields(0) & rst.fields(1) & rst.fields(2) & rst.fields(3)
rst.Movenext
Next
How to Find Test Execution Time in QTP
At the beginning of test execution store test start time in one variable as below.
TestStartTime = Now()
'

'
'
'
TestEndTime=Now()
When test ends again get the current time and calculate the time difference in hours. Here datediff
function is used to find out duration of test execution.
durationoftestExecution=datediff("n",teststarttime,testendtime)
How to define Array in QTP
Array can be created in 3 ways in QTP as mentioned below.
Fixed size Array in QTP
Dim A(10) - single dimension
Dim MyTable(5, 10) - multi-dimension

Dynamic Array - size not fixed


Dim MyArray() ReDim MyArray(25)

Using Array Function in QTP


A = Array(10,20,30)
B = A(2) ' B is now 30.
Q14. Can we create a QTP test from QC?
Yes we can create QTP test from QC but we must first make sure QTP has the ability to 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 click 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.

100 QTP Interview Questions


This questionnaire is divided into Beginner and Advance questions. If you are proficient in QTP skip to
Question # 50 here. Though, we recommend reading ALL questions, as it will prep you up for interview
1) Which environments are supported by QTP?
QTP supports the following environments

Active X

People Soft

Delphi

Power Builder

Java

SAP

.Net

Siebel

Oracle

Stingray
To learn more about Add-ins and how to use them, watch this video tutorial.

Terminal Emulator
Visual Basic
Visual Age
Web
Web Services

2) What are the types object Repositories in QTP.


QTP Supports 2 types of Object Repository
1) Shared Object Repository (also called Global)

2) Per-Action Object Repository, (also called Local)


Per-Action Object Repository is used by default. The extension for Per-Action repository is ".mtr" .
Shared Object Repository is preferable while dealing with dynamic objects which are called in multiple
tests. The extension is ".tsr"

3) Can we call QTP test from another test using scripting. Suppose there are 4 tests and I want to
call these tests in a main script. Is this possible in QTP?
Yes. You can call 4 or even more scripts in your tests.For this, first you will need to make the Actions in
the corresponding scripts re-usable.Then from the destination script you can make calls to these re-usable
actions.
4) What is action split and the purpose of using this in QTP?
Action split is to divide an existing action into two parts.The purpose is to divide actions based on their
functionality to improve code re-use.
5) How will you handle Java tree in QTP ?

Foremost you will select Java Add - In and launch QTP. Next step record operations on the Java Tree. If
you face an issue while recording, you can select Tools > Object Identification > Java, tree object and
make changes in mandatory and assistive properties to enable identification.
Tip: You can base you answer on similar lines for any other object of any environment. For example : If
the question is how will check SAP checkbox , You say , first I will select SAP Add in ... and so on.
6) Explain how QTP identifies object ?
QTP identifies any GUI Object based on its corresponding properties. While recording, QTP will identify
and store peculiar properties (as defined in the Object Identification settings) in the object repository of
the GUI object . At run-time, QTP will compare the stored property values with the on-screen properties,
to uniquely identify the GUI object.
Learn more about Object Identification
7) How many types of recording modes in QTP? Which will be used when ?
QTP supports 3 types of recording modes

1. Normal mode also called Contextual


2. Low-level recording mode
3.Analog mode
Normal Mode: It is the default recording mode and takes full advantage of QTP's Test Object Model. It
recognizes objects regardless of their position on -screen. This is the preferred mode of recoding and is
used for most of the automation activities.
Low-level recording mode: This mode records the exact x,y co-ordinates of your mouse operations. It is
helpful in testing hashmaps. It is useful for recording objects not identified by normal mode of QTP.
Analog mode: This mode records exact mouse and keyboard "movements" you perform in relation to the
screen / application window. This mode is useful for the operation such as drawing a picture, recording
signature., drag and drop operations.
Learn more about Recording Modes in QTP
8) How will you call from one action to another action ?
We can call an action in 2 ways
1) Call to copy of Action. - In this ,the Action Object Repository , Script and Datable will be copied to the
destination Test Script.

2) Call to Existing Action. - In this, Object Repository , Script and Datable will NOT be copied but a
call (reference) would be made to the Action in the source script.
9) What are Virtual Objects?
Your application may contain objects that behave like standard objects but are not recognized by QTP.
You can define these objects as virtual objects and map them to standard classes, such as a button or a
check box. QTP emulates the user's action on the virtual object during the run session. In the test results,
the virtual object is displayed as though it is a standard class object.
For example, suppose you want to record a test on a Web page containing a bitmap that the user clicks.
The bitmap contains several different hyperlink areas, and each area opens a different destination page.
When you record a test, the Web site matches the coordinates of the click on the bitmap and opens the
destination page.
To enable QTP to click at the required coordinates during a run session, you can define a virtual object for
an area of the bitmap, which includes those coordinates, and map it to the button class. When you run a
test, QTP clicks the bitmap in the area defined as a virtual object so that the Web site opens the correct
destination page.
10) How to perform Cross platform testing and Cross browser testing using QTP? Can u explain
giving some example?
You will need to create separate Actions which take care of different OS and Browsers
Cross Platform Testing:
Using the Built in Environment Variable you can dig up the OS information.
Eg. Platform = Environment("OS"). Then based on the Platform you need to call the actions which you
recorded on that particular platform.
Cross Browser Testing:
Using this code Eg. Browser("Core Values").GetROProperty("version") you can extract the Browser and
its correspondin version. Ex: Internet Explorer 6 or Netscape 5. Based on this value you call the actions
which are relevant to that browser.
11) What is logical name of the object?
Logical name is a name given by QTP while creating an object in the repository to uniquely identify it
from other objects in the application. This name would be used by the QTP to map the object name in
script with its corresponding description in the object repository. Ex:
Browser("Browser").Page("Guru99") Here Guru99 is the logical name of the object.

12) What is descriptive programming?


Typically ,an object and its properties must be recorded in the Object Repository to enable QTP to
perform action s on it.
Using descriptive programming , you do not store the object and its property values in the Object
repository but mention the property value pair directly in the script.
The idea behind descriptive programming is not bypass the object repository but help recogonize dynamic
objects.

Learn more about Descriptive Programming


13)What are the properties you would use for identifying a browser & page when using descriptive
programming ?
You can use the name property
ex: Browser("name:="xxx"").page("name:="xxxx"").....

OR
We can also use the property "micClass".
ex: Browser("micClass:=browser").page("micClass:=page")....
14)Can we record an application running on a remote machine using QTP ?
Yes .you can record remote application provided you are accessing application through the local browser
not via remoter like citrix.
If you are still unable to record it is advisable install QTP and application, on the same machine
15) 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.

Example : Set IE = CreateObject("InternetExplorer.Application")


16) Can you switch between Per-Action and Shared Object Repository ? If yes how ?
Yes .We can switch. Go to Test--->Settings--->Resources. Here you have an option to choose
repositories.

17) What is Object Spy ? How to Use it ?


Object Spy helps in determining the run & test time object properties & methods of the application under
test.
You can access object spy directly from the toolbar or from the Object Repository Dialog Box.
It is very useful during Descriptive Programming
Learn more about Object Spy
18) When ordinal identifiers alone can make an object unique then why they are not given top
priority? Why it is first mandatory and next assistive. Why we cannot go for ordinal identifiers
directly?
Consider the following a) If two objects are overlapped on each other than location based object recognition will fail.
b) If only index based recognition is used your script will work but script execution time will increase.
Hence mandatory and assistive properties are used.
19) What is the file extension of the code file in QTP?
Code file extension is script.mts
20) Explain in brief about the QTP Automation Object Model.
QTP Automation Object model deals with Automation of QTP itself. Almost all configuration and
functionality provided by QTP is represented by QTP's Automation Object Model . Almost all dialog
boxes in QTP have a corresponding automation object which can set or retrieved using the corresponding
properties or methods in the Automation Object Model.QTP Automation Objects can be used along with
standard VB programming elements like iterative loops or conditional statements to help you design a
script of choice.
21) What is the use of Text output value in QTP?
Text Output values enable you to capture text appearing on the application under test during run-time.

If parameterized, text output values will capture values appearing in each iteration which would be stored
in the run-time data table for further analysis.
22) What is Step Generator?
Step Generator enables use to Add Test Steps in your script. Using step generator you can add steps to
your script without actually recording it.
23) How to make QTP understand the difference amongst the same type of objects .Suppose there
are 5 check boxes in a page and I have to choose the 2nd one, how to do that through script?
You can use ordinal identifiers like index along with a little descriptive programming for object
recognition.
Watch a video of this example.
24) What is Test Fusion Report ?.
Test Fusion report displays different aspects of the test run, soon after the tester has run a test. A high-level results overview, and
expandable Tree View of the test, test data used, the screen shots of the application for every step which highlights discrepancies if
at all and each check point pass a failures deep explanation; are the aspects. The combination of Test Fusion reports and Quick
Test Pro, the reports can be shared across an entire Quality Assurance and the development team.

25) How can you handle exceptions in QTP?


In QTP Exceptional handling is done by using
a. Recovery Scenarios.
b. Using On Error statement
In Recovery scenario you have to define.
1. Triggered Events.
2. Recovery steps.
3. Post Recovery Test-Run.
At Script Level you can use the On Error Resume Next and On Error Go to 0 statement.
26) What are the types of environment variables in QTP ?
Environment variables in QTP are of three types:
1) Built-in (Read only)
2) User-defined Internal (Read only)
3) User-defined External (Read/Write)
You Set the Environment Variable using the following syntax

Environment.Value( "name") = "Guru99"


You can Retrieve the Environment Variable using following syntax
Environment.Value("name") -- This will retrun name as Guru99
Environment.Value("OS") -- This will return your system OS
27) What is the Difference between Bitmap Check point & Image Check point?
Bitmap checkpoint does a pixel to pixel comparison of an image or part of an image.
Image checkpoint does do a pixel to pixel comparison but instead compare image properties like alt text ,
destination url etc.
28) What is the difference between functions and actions in QTP?
Actions have their own Object Repository & Data Table. Actions help make your Test modular and
increase reuse. Example: You can divide your script into Actions based on functionality like Login,
Logout etc.
Functions is a VB Script programming concept and do not have their own Object Repository or Data
Table. Functions help in re-use of your code. Ex: You can create a Function in your script to concatenate
two strings.
29) What is keyword view and Expert view in QTP?
Keyword View is an icon based view which shows test steps in tabular format. It also automatically
generates documentation for the test steps.
Expert View gives the corresponding VB Script statement for every test step in the Keyword view.
30) Explain QTP Testing process? Quick Test testing process consists of 6 main phases:
1) Create your test plan - This is preparatory phase where you identify the exact test steps, test data and
expected results for you automated test. You also identify the environment and system configurations
required to create and run your QTP Tests.
2) Recording a session on your application - During this phase , you will execute test steps one by one on
your AUT ,and QTP will automatically record corresponding VB script statements for each step
performed.
3) Enhancing your test - In this stage you will insert checkpoints , output values , parameterization ,
programming logic like ifelse loops to enhance the logic of your test script.
4) Replay & Debug - After enhancements you will replay the script to check whether its working properly
and debug if necessary.

5) Run your Tests - In this phase you will perform the actual execution of your Test Script.
6) Analyzing the test results - Once test run is complete, you will analyze the results in the Test Fusion
report generated.
7) Reporting defects - Any incidents identified needs to be reported. If you are using Quality Center ,
defects can be automatically raised for failed tests in QTP.
31) What are the different types of Test Automation Frameworks ?
The types of Automation Frameworks are 1) Linear Scripting - Record & Playback
2) The Test Library Architecture Framework.
3)The Data-Driven Testing Framework.
4)The Keyword-Driven or Table-Driven Testing Framework.
Learn more about Test Automation Frameworks.
32) How will you check a web application for broken links using QTP?
You can use the Page Checkpoint which gives a count of valid/invalid links on a page.
33) What is a Run-Time Data Table? Where can I find and view this table?
Data like parameterized output , checkpoint values , output values are stored in the Run-time Table. It is
an xls file which is stored in the Test Results Folder. It can also be accessed in the Test Fusion Report.
34) What is the difference between check point and output value.
Check point is a verification point that compares a current value for a specified property with the
expected value for that property. Based on this comparison, it will generate a PASS or FAIL status.
An output value is a value captured during the test run and can be stored in a specified location like the
Datable or even a variable. Unlike Checkpoints, no PASS/FAIL status is generated.
35) How would you connect to database using vbscript ?
To connect to the database you must know
a) connection string of your server
b) username
c) password

d) DNS name
You can code the database connectivity command directly or you can use the SQL Query tool provided
by QTP.
36) What is QTP batch testing tool?
You can use the Batch testing tool to run multiple scripts. Once the scripts are added in the tool , it will
automatically open the scripts and start executing them one after the other.
37) What are the drawbacks of QTP?
As of QTP version 10
1) Huge Tests in QTP consume lots of memory and increase CPU utilization.
2) Since QTP stores results in HTML file (and not txt) the result folder sometimes becomes big.
38) What is an Optional Step ?
A step when declared optional is not mandatory to be executed. If the corresponding GUI object is
present, QTP performs the operation on it. If the GUI object is not present, QTP bypasses the optional
step and proceeds to execute the next step.
39) What is Reporter.ReportEvent ?
Reporter.Reportvent is standard method provided by QTP to send custom messages to the test results
window.
Syntax
Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
where
EventStatus = 0 or micPass
1 or micFail
2 or micDone
3 or micWarning
Results can assume any status like Pass , Fail , Warning etc. You can also send screenshot to the test
results window.
40) How will you declare a variable in QTP ?
You declare using a DIM keyword. You assign value to the variable using the SET keyword.

Ex.
Dim temp 'Will declare the temp variable
Set temp = 20 ' Will assign a value 20 to temp.
41) What is GetRoProperty ?
GetRoProperty is a standard method provided by QTP to fetch property values of a run -time object.
42) What is smart Identification?
Typically, if even one of the on-screen object property does not match the recorded object property. The
test fails.
In smart identification, QTP does not give an error if the property values do not match, but uses Base
filter and Optional Filter properties to uniquely identify an object. In Smart identification, if a property
value does not match the script does not fail but it proceeds ahead to compare the next property. Smart
identification can be enabled in Object Identification Dialog box.
Learn more about SMART Identification
43) How would you export a Script from one PC to another in QTP ?
We can make use of the "Generate Script" function available in Object Identification, Test Settings and
Tools/Options tab to create a zip of the script at the source computer. These zip files then can be imported
into QTP at the destination computer.
44) Can launch two instances of QTP on the same machine ?
No. You can work with only single instance of QTP on the same machine. But QTP itself can work on
multiple instances of the Application Under Test (AUT). Ex: QTP can handle multiple IE browser
windows.
45) Give the syntax to import/export xls into QTP.
DataTable.ImportSheet "..\..\TestData\Input.xls",1,dtGlobalSheet
DataTable.ExportSheet "..\..\Results\Output.xls","Global"
46) What is SetToProperty ?
SetToProperty changes property of an object stored in the Object Repository. However these changes are
not permanent.
47) What is the standard timing delay for web based application in QTP ?
The standard delay is 60 seconds. This is can be changed in Test Settigns.

48) What is the Action Conversion Tool ?


It is an in-built tool provided by QTP to convert Actions into Business Process Components.
49) What is the extension for a function library ?
The extension is '.QFL'
50) If the Global Data sheet contains no data and the Local Datasheet contains two rows of data,
how many times will the test iterate?
The test will iterate only once - global iteration.
51) Explain how to read registry key in UFT ?
The example demonstrated here explains how to read registry key in UFT
Create a shell object

Set MyShell= CreateObject (WScript.Shell)

Read the value of key from the registry

RegValue =MyShell.RegRead (varpathofkey)

in above function we have to pass the path of key in registery.

e.g. HKCU\software\ie\settings

msgbox RegValue

52) What are the ways in UFT to get system environment variables in UFT?
There are three ways to get system environment variables in UFT
Use the WSH shell object

Use WMIs Win32_Environment Class


Read variables from the registry
Set myShell = CreateObject (WScript.Shell)

WScript.Echo myShell.ExpandEnvironmentStrings( "%PATHEXT%" )

myShell=Nothing,

The output will be .BAT;.CMD;.VBS;. VBE;. JS;. JSE


Other user variable, like TEMP, overwrite their system counterpart
Set myShell = CreateObject( "WScript.Shell" )

WScript.Echo myShell.ExpandEnvironmentStrings( "TEMP=%TEMP%" )

myShell=Nothing

The output will be


TEMP:C:\DOCUME~1\You\LOCALS~1\Temp
53) Mention the steps required in UFT to send mail from outlook?
To send mail from outlook in UFT,
Set Outlook = CreateObject ("Outlook.Application")
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = Subject
.HTMLBody = TextBody
.Recipients.Add (aTo)
Const olOriginator = 0
.Send
End With

54) Explain how you can fetch data from database in UFT?
To fetch data from database in UFT, you have to follow the code below
Set db= createobject (ADODB.Connection)
db.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\guru99\vb6\admission_project.mdb;
Persist Security Info= False
Set rst=createobject(ADODB.Recordset)
rst.Open select*from Course, db, 3
id=rst. RecordCount

For i=0 to id-1


Print rst.field (0) & rst.fields (1) & rst.fields (2) & rst.fields (3)
rst.Movenext
Next

55) What are the codes we can use to get files from ftp server in UFT?
To get ftp files from ftp server, you have to use below code
a)

put- To store single file on server

b)

get- To download single file from ftp server

c)

mget- To download multiple files from server

d)

mput- To store multiple files on server

e)

delete- To delete files on ftp server

MyShell.Run "%comspec% /c FTP -n -s:" & commandstoworkwithftp & " " & Site, 0,True

56) In UFT how you can prevent the system from getting locked?
To prevent system getting locked, any of the two ways can be used

Create a simple vbs file having code to press numlock key and run that vbs file

Edit one registry key DisableLockWorkstation =1 to disable locking


57) What is descriptive programming in UFT means?
Descriptive programming includes property name and property value. Whenever UFT is facing difficulty
in identifying objects from object repository, and instead the object is directly identified from the script is
known as descriptive programming.
58) In UFT explain the difference between qfl and vbs files?
a)

qfl is quick test function library file while vbs is Microsofts vbscript

b)

qfl is a non-executable file while vbs is an executable file

c)
To use file in UFT associate qfl file from test setting, while to include vbs file use execute file
statement
59) What is the code to write data to text file in UFT?
To write data to text file in UFT code is
Content = Guru99 Rocks
Set Fo = createobject ("Scripting.FilesystemObject")

Set f = Fo.openTextFile ("c:\myFile.txt",8,true)

' open in write mode

f.Write (contents)
f.Close
Set f = nothing

60) How to write data to excel file in UFT?


Code to write data to excel file in UFT is
filepath = C:\Bugs\Reports.xlsx
Set objExcel = CreateObject(Excel.Application)
objExcel.Visible= True
Set Wb= objExcel.Workbooks.Open (filepath)
Wb.worksheets(1).Cells(1,1).Value = guru99 read value from Excel file

61) How to create TSR file in UFT?


TSR means Test Shared Repository, it is created to share object repository.
To create TSR file, follow the steps

Open object repository

Go to file menu

Go to export local objects option and select it


After that, UFT will ask you to store .tsr file. Give the path and save. This will create .tsr file in UFT
62) How to connect to QC in UFT?
To connect with QC, UFT provides the option to connect QC directly from UFT GUI.
a)

Go to file menu

b)

Select (QC) quality center

c)

You will be asked to - Enter QC url

d)

Enter user id, password and project

Following above steps will allow you to connect with QC, later on you can execute the tests from QC
itself.
63) What are the types of Automation Framework in UFT?
In order to ease the process of test automation using UFT, test automation is designed. There are mainly
three types of automation frameworks in UFT

Keyword Driven Framework: It is used when multiple functionality needs to be tested.

Data Driven Framework: It is used to test same flow with different test data, test data is given
more importance than multiple functionality of application

Hybrid Framework: It is a combination of data driven framework and keyword.


64) When we should use descriptive programming in UFT ?
Either through object repository or description programming, UFT identifies objects. Descriptive
programming is used in following scenarios
a) It is used to remove duplicate objects. Same objects exists in different screens or windows of your
application. If you use OR in this case you have to store same object under different object hierarchy in
OR. To deal with such situation, descriptive
programming is used
b) It is not appropriate in certain scenarios to store the objects inside OR (Object Repository).
Suppose if you want to print 100 links on the page, you should not store all links in OR. Instead you
should use Description Programming to access those links.
65) What is settoproperty and when to use it in UFT?
Settoproperty stands for set test object property. You can use this property to change the object values at
runtime. You can edit the property values during the runtime, but the changes that are made are
temporary.
66) How to create an array of dictionary in UFT?
We can create an array of dictionary using syntax
Dim ArrayofDictionary(2)
First element of array
Set ArrayofDictionary(0)= createobject("scripting.dictionary")
ArrayofDictionary(0).Add "key1", "temp1"
ArrayofDictionary(0).Add "key2", "temp2"
Added keys in first dictionary
Second element of array as dictionary
Set ArrayofDictionary(1)= createobject("scripting.dictionary")
ArrayofDictionary(1).Add "key1", "temp1"
ArrayofDictionary(1).Add "key2", "temp2"
Added keys in second dictionary..and so on

67) What is the difference between Array and Dictionary?

Array

Dynamic array is possible

Dictionary

There is no concept of dynamic dictionary

Size of array must be set before the use of

array

We have to use redim statement before


adding extra element into dynamic array

To add extra element there is no need to


write any statement. We just use add method

There is no particular method to release the


memory if particular element is not required

Element which is not required any longer


can be removed from the dictionary

The size of dictionary do not need to be set

68) What is round function in UFT?


Round function in UFT is used to round the decimal
For example
Mydecimal = 6.3433333
Roundedvalue= Round(Mydecimal , 3)
Print roundedvalue,

it will print 6.343

69) How to find the total number of rows in the webtable in UFT?
There are three ways which we can find the count of rows in the table in UFT
a) Using rowcount property of UFT webtable object
b) Using GetROProperty of UFT
c) Using HTML DOM + UFT
70) How to create excel file in UFT ?
steps will create excel file in UFT,
'Create a new Microsoft Excel object
Set myExcel = createobject("excel.application")
'To make Excel visible
myExcel.Application.Visible = true
myExcel.Workbooks.Add
MyExcel.worksheets(1).Cells(1,1). Value = Scenario Id
MyExcel.worksheets(1).Cells(1,2).Value = Scenario Name
MyExcel.worksheets(1).Columns(1).ColumnWidth = 10
MyExcel.worksheets(1).Columns(2).ColumnWidth = 40
MyExcel.worksheets(1).Columns(3).ColumnWidth = 20

MyExcel.worksheets(1).Columns(4).ColumnWidth = 20
MyExcel.SaveAs "c:\guru99.xlsx"
MyExcel.close
objExcel.Quit
blnFlag = False

72) Explain in what ways we can export datatable to excel in UFT?


To export data-table to excel, there are two methods.
a)

DataTable.Export (C:\export.xls)

b)

DataTable.ExportSheet C:\mysheet.xls ( If excel file does not exist, new file is created)

73) In datatable sheet in UFT, how to read a value from the cell?
To read a value from the cell, we follow 2 step process
a)

We set the row pointer in first step

b)

In second step we define the parameter/column name from the sheet to read

Example:
For this example, we have set the row pointer to 2 in transaction sheet
Datatable.GetSheet(Transactions).SetCurrentRow(2)
Now, we have to specify that we want to read a value from the module_name column from the transaction
sheet
Print datatable.Value (Module_Name, Transactions)
73) What are the loops available in UFT and what they do?
There are 3 loops available in UFT
a)

Do..Loop : Do Loop will run a block of statements repeatedly

b)

For..Next : For Next Loop will execute a series of statements until a specific counter value

c)
ForEach : In order to execute a series of statements for each statements for each object in
collection For Each Loop is used
While.Wend Loop : While Wend Loop is used to execute a series of statements as long as given
condition is true
74) What are the types of error need to be handle in UFT?

There are three types of error that one will face in UFT
a)

Syntax Errors

b)

Logical Errors

c)

Runtime Errors

75) What are the ways you can handle run time errors?
There are various ways to handle run time errors
a)

Using test settings

b)

Using on error statement

c)

Using err Object

d)

Using Exit Statement

e)

Recovery Scenarios

f)

Report Object

76) What is the difference between exitaction and exititeration?


Exitaction is used when we want to exit from a particular action, while exititeration is used to exit from a
particular action iteration of an action.
77) In QTP how you can remove the spaces from string?
You can use replace function to remove spaces from string in QTP
Print replace( sdsd sd sd s , ,)
Output will be sdsdsdsds
Itrim function can be used if only leading spaces from string needs to be removed
Print Itrim( sdsd sd s ) Output will be sdsd sd s
You can use rtrim function to remove trailing spaces from string
Print rtrim( sdsd sd s ) Output will be sdsd sd s
78) In QTP how you can get the last character from a string?
Code to get the last character of a string in QTP
print right( junior,1) Output will be r

79) How to add synchronisation points in QTP?


There are 4 ways through which we can add synchronisation points in QTP
a)

Wait statement : This statement will pause the execution for x seconds until object comes up

b)

Wait property : This method will wait until property of object takes particular value

c)

Exist statement : This statement will wait until object becomes available

d) Sync method: The code will wait until browser page is completely loaded. For web application
testing this method is used.
80) In QTP explain what is crypt object
Crypt object in QTP is used to encrypt a strings.
Syntax
Crypt.Encrypt(Guru99)
Example :
In this example, value in pwd variable is encrypted using the Crypt. Encrypt method.
Then this encrypted value is entered into editbox.
pwd= myvalue
pwd = Crypt.Encrypt (pwd)
Browser(myb).WinEdit (pwd). SetSecure pwd

81) Mention what is the difference between Excecute file and loadfunction library ?
In execute file, we cant debug the statements. With loadfunction library, statements can be debug and
can also load multiple library files.
82) Explain how you can find length of array in QTP?
The code to find the length of array in QTP is
print (ubound(arr)+1)
Ubound returns the last index in array- so length of array will be +1. This will be total number of
elements in array
83) Mention what are the different types of recording modes in QTP? Which will be used when?
QTP supports 3 types of recording modes

a) Normal mode : It is the default recording mode and used for most of the automation activities.
Regardless of their position on screen it recognizes objects.
b) Low level recording mode: It is useful for recording objects not identified by normal mode of QTP.
It records the exact x,y coordinates of your mouse operations.
c)
Analog mode: This mode is useful for the operation such as recording signature, drawing a picture,
drag and drop operation.
84) In what ways you can call from one action to another action?
There are two ways you can call from one action to another action
a) Call to copy of action: In this, the script and data-table, action object repository will be copied to
the destination Test Script
b) Call to existing Action: In this, script data-table and object repository are not copied instead a call
reference would be made to the action in the source script
85) What is Optional step in QTP ? How you can add optional step in QTP?
When running a test, it test fails in opening a dialog box, QTP does not necessarily abort the test run. It
bye passes any step designated optional and continues running the test. By default QTP automatically
marks as optional steps that open certain dialog boxes. In order to set an optional step in the keyword,
right click and select Optional Step. The icon for optional step would be added in next step. In the
expert view to add optional step, add optional step to the beginning of the VBScript statement.
86) How to define array in QTP?
Array can be defined in 3 ways in QTP
a)

Fixed size array in QTP

Dim A (10) - single dimension


Dim MyTable (5,10) multi-dimension
b)

Dynamic array-size not fixed

Dim MyArray()ReDim MyArray(25)


c)

Using Array Function in QTP

A= Array (10, 20,30)


B= A(2) B is now 30
87) How you can write contexts to text file in QTP?

Content = Guru99
Set Fo = createobject(Scripting.FilesystemObject)
Set f =Fo.openTextFile(c:\abc.txt, 8,true)
f.Write (contents)
f.Close
Set f= nothing

88) When option explicit keyword is used in QTP?


To specify that all variable must be declared before use in QTP, Option Explicit keyword is used.
89) In QTP how you can exit for loop?
You must use Exit For statement to exit for loop in QTP. Exit For statement will get the control out
of the for loop
For count= 1 to 3
TempNum= mid(Tempstr,count,1)
If isnumeric(TempNum) Then
LenghtNum = LengthNum & TempNum
Else
Exit For
End If
Next
GetStrLenNumber = LengthNum

90) How to find array size in QTP?


Size of an array in QTP will be found by using the following code
Print (ubound(arr)+1)
Ubound returns the last index in array- so size of array will be +1
91) In QTP, explain what is qrs file?
qrs means Quicktest Recovery Scenario. By using recovery scenario manager we can handle
exceptions in test execution.In QTP using recovery scenario manager we can handle exceptions in test
execution. In QTP when you create a recovery scenario, you must save it in .qrs file. qrs file may have
any number of scenarios defined in it.
92) What is the significance of action 0 in QTP?

Action 0 is created by default when you create a new test in QTP along with action 1. To determine the
sequence in which we call other actions 1,2,3 etc. action 0 is used.
93) Explain how you can replace string in QTP?
To replace part of string in QTP we will use the code as shown below
Example,
Str = (Guru99)
Suppose if you want to replace 99 with 88 then the code will
print replace(str,99, 88) output will be Guru88

94) What are the various automation frameworks available in QTP?


Various types of automation frameworks available in QTP are
a)

Linear Scripting

b)

The Test Library Architecture Framework

c)

The Data Driven Testing Framework

d)

The Keyword Driven or Table Driven Testing Framework

e)

The Hybrid Test Automation Framework

95) What is Object Spy and what is the function of object spy in QTP?
Object Spy is a feature in QTP by using which you can view both the test and run time object properties
and methods.
96) What is GetROProperty and what are the steps involved in using GetROProperty?
GetROProperty is an in built method used to retrieve runtime value of an object property.
To use GetRoProperty it involves four steps
a)

Record the object on which you want to use the GetROProperty in Object Repository

b)

Identify the run time property for the recorded object which could be used

c)

To retrieve the identified run time property and store the value in a variable

d)

Use this value for further deductions

97) Explain how you can find the absolute value of the number in QTP?
To find out the absolute value of a number a built in function in QTP is available

Example-

a= -1

Print abs(a) output will be 1

This code will find the absolute value of a number


98) How you can check if parameter exists in Datatable?
To check whether if parameter exists in data table we will use the code
on error resume next
val=DataTable(ParamName, dtGlobalSheet)
if err.number<>0 then
Parameter does not exist
else
Parameter exists
end if

99) In QTP explain what is keyword driven automation framework?


In keyword driven automation framework, the focus is mainly on keywords/functions and not the test
data. It means the complete focus is on creating functions which maps the functionality of the
application.
100) In QTP how you can use Xpath to identify objects?
Xpath can be used to identify only web objects. We can use the following code to identify objects.
Set oPage=Browser(myGoogle).Page(myGoogle)
oPage.WebEdit(xpath:=//INPUT[@name=nameofeditbox]).Set search term
Enter value in google edit box

Here you can get 3 Questions bonus :-)


101) Explain how you can delete excel file in QTP? To delete excel file in QTP, Set fo =
createobject(Scripting.filesystemobject) fo.deletefile(C:\xyz.xlsx) Set fo=nothing
102) What factors affect bitmap checkpoints ?
Bitmap checkpoints are affected by screen resolution and image size.
103) What is Accessibility Checkpoint?
World Wide Web Consortium (W3C) came up with some instructions and guidelines for Web-based
technology and information systems to make it easy for the disabled to access the web. For example the
standards make it mandatory to have an 'alt text' for an image. So a blind person who is accessing the

website, will use text - to -speech converters and at least understand what the image is about if not see it.
All these standards are checked by Accessibility Checkpoints.

Vous aimerez peut-être aussi