Vous êtes sur la page 1sur 39

An Introduction to

HP QuickTest Professional (QTP)


QTP – An Introduction
Ø Quick Test Professional is the flagship functional testing tool from
HP (primarily from Mercury Interactive).

Ø It is an icon based tool, which automates the functional & regression


testing of an application.

Ø QTP is easier to use and implement for both technical & non
technical testers in comparison to other functional testing tools
available.

Ø Latest Available versions is QTP 11.0


Salient Features
Ø Scripting Language is VBScript which is easy to use , understand
and program even complex functionalities with ease..
Ø Uses “Active Screen” technology to record scripts which aids the
tester in referring to the screens object properties.
Ø Library files contains VBScript functions and subroutines that can
be added to the test.
Ø Support Modern Development Environment.

The Main Screen
Menu
Bar

File
toolbar

Test
toolbar

Test pane

Object

Action
Screen
Important Toolbars
Ø Test toolbar: containing buttons to assist you in the testing process
Ø Debug toolbar: containing buttons to assist you in debugging your test
Ø Action toolbar: containing buttons and a list of actions, enabling you to
view the details of an individual action or the entire test flow
Ø Test pane: containing two tabs to view your test—the Keyword View
and the Expert View
Ø Test Details pane : containing the Active Screen
Ø Data Table: containing two or more tabs to assist you in parameterizing
your test—Global and one tab for each Action
Test Object Model
Ø This is a large set of object types or classes that Quick Test uses to
represent the objects in AUTs
Ø Properties
Ø Methods
Ø
Ø A test object is an object that
 - represents the actual object
 - stores information about that object.

Ø A run-time object is the actual object in the AUT.



Test Object Model
Run Time Object Test Object

Ø QTP Test
Ø Object
Modeling

Quick Test Professional maps the Run Time Object to


a Test Object already present in its repository.

Once recognized it can repeat all our actions.


Objects
You may have called your button as
button1, but QTP recognizes it
with the name Calculate

HTML Code for the button CALCULATE

<INPUT id=button1 type=button


value=“Calculate” name= “button1” title=""
LANGUAGE=javascript onclick="return
button1_onclick()">
Object Repository

Object Repositories
Object Repository
Object Repositories
Ø Object Repository acts as a translator between QTP script and the
Operating System ( similar to GUI map concept in win runner).
Ø

Types of Object Repositories


Ø Shared Object Repository


Ø Per Action Object Repository

Per Action vs Shared Object Repository
Per Action Object Repository Shared Object Repository
ØSeparate action repository for each Øcan use the same shared object
action. repository file for multiple tests.
ØIf an object description changes, you ØIf an object description changes, you only
need to modify the object in every have to modify in the shared Object
action repository using that object. Repository – all tests will playback
ØNo need for any Object Repository properly.
administrator. ØRequires Shared object repository

ØPreferred method if application won’t creation and maintenance.


change during renovation ØCrucial if application may change during

ØDefault Object Repository. Preferable for renovation


novice QTP users. ØMost commonly used across Automation
Ø projects.
Ø
Record & Playback
To Record a Test

Ø Steps to follow:
Ø 1 Open Quick Test.
Ø
Ø 2 Open a test:
Ø To create a new test,
click on New
Ø To open an existing
test, click on Open
Ø
Ø 3 Click the Record button If
you are recording for the
first time the Record and
Run Settings dialog box
opens.
Ø
Playback

Sprint\zXC
abcde
Keyword View
1. Actions bring in modularity

2. Iteration can be controlled.

3. Actions can be reused.

1.First name is the name of the edit box.

2.Set is the method


Expert View

The Expert View uses VBScript


Check Points in QTP

A checkpoint verifies that expected information is displayed


in your application while the test is running.
Types of Check Points
Inserting Check Points

Right Click the object and select Insert


Checkpoint.
Analyzing a Test with Check Points

Checkpoint
Failed

Checkpoin
t
Passed
Synchronization Points
What is a Synchronization Point?

Ø
Ø A synchronization point is a line in the test script that instructs
QTP to wait for a certain response from the application during
playback.
Why Synchronize?
Without synchronization point With synchronization point

t
rip

rip
T

T
U

U
Sc

Sc
A

A
Run script Run script

Inputs Inputs data Accepts


data to Accepts to AUT input
AUT input
Sends data to Wai Sends data to
Attempts database database
next step ts server
server

Synchronizati
Server

on point
Script Wai
fails Waits for processes
server; ts data
cannot
continue Wai Server
ts returns
results
Client affirms
Continues transaction is
complete
How to Add Synchronization Points
ØLocate the lines in the script to insert the synchronization point

ØIn Quick Test choose Insert > Step > Synchronization Point. The
mouse pointer turns into a pointing hand. This should be done
while recording.

ØUsing the Hand Pointer click on the object to Synchronize.

ØAdd Synchronization Point dialog box opens.


Ø
Ø
How to Add Synchronization Points

ØSelect the Property name and its corresponding value which you want to
use for the synchronization point.
Ø
ØEnter the synchronization point timeout (in milliseconds) and Click OK. A
Wait Property step is added to your test.
Ø
For e.g for this case the step inserted in the script will be
Dialog(“Login”).WaitProperty "enabled", 1, 10000
Test Parameterization
How Long Does it Wait?

Ø TIME PARAMETER (test script)


Ø +
Ø Object synchronization timeout
(Test Settings)
Ø =
Ø TOTAL TIME

Why Parameterization ?
Ø Parameterization allows us to pick different values at run time.

Ø Reduces Time and Effort.

Ø Usage of data drivers allow us to use the same data for various
input boxes.

Ø Parameterization can also be done for checkpoints.



Parameterization Continues

1. The hard coded values can be made to vary.


2. The values will be taken from the excel sheet.
3. Right click on the object name and select method
arguments
Global and Action Data Sheets
Ø The Data Table contains two types of sheets:
Ø
Ø Global sheet: This enables you to share information from one action
to another. Should be used for data drivers and Output Values.
Ø
Ø Action Sheet: Each action also has its own sheet in the Data Table so
that you can insert data that applies only to that action.
Ø
Ø When there are parameters in a current action’s sheet, you can set
Quick Test to run one or more iterations on that action before
continuing with the current global iteration of the test.
Output Values
Ø Used when the output for one action is to be used as an input for a
subsequent action.

Ø This can be parameterized.

Ø Even labels can be used as output values.


Analyzing Test Results
Test Results Window
Test
Results
Tree

Test
Result
Details

Status
Summary
Test Results
ØTest Results Tree - an icon-based view of the steps that were performed
while the test was running. Similar to the test tree in Quick Test main
screen

ØIteration Summary – Provides the Status (pass/Fail) of each iteration


individually.

ØStatus Summary - Indicates the number of checkpoints or reports that


passed, failed, and raised warnings during the test.
Ø
Viewing Test Results

Iteration Failed
Actions
Actions
Ø Actions can divide a test into several distinct business Processes.

Ø Each actions signifies a logical independent test.

Ø To divide a test into actions you can


Ø Insert a New Action
Ø Split an existing action into two Actions
Ø Insert a copy of an existing Action
Ø Insert a call to an existing Action

Ø In this way several actions can be integrated to each other within


the test or across different tests logically.

ck on the new Action Creating Actions
Icon

ame of the new Action and assign its


attributes
Thank You

Vous aimerez peut-être aussi