Q. What are the features and benefits of Quick Test Pro(QTP)?
1. Key word driven testing
2. Suitable for both client server and web based application
3. VB script as the script language
4. Better error handling mechanism
5. Excellent data driven testing features
Q. How to handle the exceptions using recovery scenario manager in QTP?
You can instruct QTP to recover unexpected events or errors that occurred in your testing environment during test run. Recovery scenario manager provides a wizard that guides you through the defining recovery scenario. Recovery scenario has three steps
1. Triggered Events
2. Recovery steps
3. Post Recovery Test-Run
Q. What is the use of Text output value in QTP?
Output values enable to view the values that the application talks during run time. When parameterized, the values change for each iteration. Thus by creating output values, we can capture the values that the application takes for each run and output them to the data table.
Q. How to use the Object spy in QTP 8.0 version?
There are two ways to Spy the objects in QTP
1) Thru file toolbar: In the File ToolBar click on the last toolbar button (an icon showing a person with hat).
2) Thru Object repository Dialog: In Objectrepository dialog click on the button “object spy…” In the Object spy Dialog click on the button showing hand symbol. The pointer now changes in to a hand symbol and we have to point out the object to spy the state of the object. If at all the object is not visible or window is minimized then hold the Ctrl button and activate the required window to and release the Ctrl button.
Q. What is the file extension of the code file and object repository file in QTP?
File extension of
Per test object rep: filename.mtr
Shared Object rep: filename.tsr
Code file extension id: script.mts
Q. Explain the concept of object repository and how QTP recognizes objects?
Object Repository: displays a tree of all objects in the current component or in the current action or entire test( depending on the object repository mode you selected).
we can view or modify the test object description of any test object in the repository or to add new objects to the repository.
Quicktest learns the default property values and determines in which test object class it fits. If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description. If no assistive properties are available, then it adds a special Ordianl identifier such as objects location on the page or in the source code.
Q. What are the properties you would use for identifying a browser and page when using descriptive programming?
“name” would be another property apart from “title” that we can use. OR
We can also use the property “micClass”.
ex: Browser(“micClass:=browser”).page(“micClass:=page”)
Q. What are the different scripting languages you could use when working with QTP?
You can write scripts using following languages:
Visual Basic (VB), XML, JavaScript, Java, HTML
Q. Tell some commonly used Excel VBA functions.
Common functions are:
Coloring the cell, Auto fit cell, setting navigation from link in one cell to other saving
Q. 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.
Q. Explain in brief about the QTP Automation Object Model.
Essentially all configuration and run functionality provided via the QuickTest interface is in some way represented in the QuickTest automation object model via objects, methods, and properties. Although a one-on-one comparison cannot always be made, most dialog boxes in QuickTest have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods. You can use the objects, methods, and properties exposed by the QuickTest automation object model, along with standard programming elements such as loops and conditional statements to design your program.
Q. How to handle dynamic objects in QTP?
QTP has a unique feature called Smart Object Identification/recognition. QTP generally identifies an object by matching its test object and run time object properties. QTP may fail to recognize the dynamic objects whose properties change during run time. Hence it has an option of enabling Smart Identification, wherein it can identify the objects even if their properties changes during run time.
Check out this:
If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description, and uses the Smart Identification mechanism to try to identify the object.
While the Smart Identification mechanism is more complex, it is more flexible, and thus, if configured logically, a Smart Identification definition can probably help QuickTest identify an object, if it is present, even when the recorded description fails.
The Smart Identification mechanism uses two types of properties:
Base filter properties – The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link’s tag was changed from to any other value, you could no longer call it the same object. Optional filter properties – Other properties that can help identify objects of a particular class as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.
Q. What is a Run-Time Data Table? Where can I find and view this table?
In QTP, there is data table used, which is used at runtime.
-In QTP, select the option View->Data table.
-This is basically an excel file, which is stored in the folder of the test created, its name is Default.xls by default.
Q. 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. 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 can’t. 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. 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. 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 Pop-up 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. 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. 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 Microsoft’s 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. 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. 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. 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. 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. 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. 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. 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. What are the main stages of Testing with QTP?
Testing with QTP involves main stages like:
Planning
Creating Tests
Running Tests
Analysing Results
Q. 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. What is Business Process Testing?
Business Process Testing is a role-based testing model that enables Subject Matter
Experts—who understand the various parts of the application being tested—to create
business process tests in Quality Center. Automation Engineers—who are experts in QTP
and automated testing—use 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 easily-maintained, reusable unit comprising one or more steps that
perform a specific task within an application.
Q. 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. 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. 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 QuickTest.
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. 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. 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
picture—just 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 child’s 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. 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 then
“looks” 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 object’s location on the
page or in the source code, to create a unique description.
Q. 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.
Run-time 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. 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. 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. 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. 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. 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.