Sunteți pe pagina 1din 80

Quality. Commitment .

Technology
Quick Test Professional (QTP)
Presentation 1 Presentation 1
Course Objective
Participants should be able to create
basic test scripts from a manual test
case and add verification steps to test
scripts.

Participants should be able to
parameterize tests and run integrated
test scenarios
Course Coverage
Introduction to QTP
Create basic scripts from a manual test case
Learn to add verification steps to test scripts
Manage objects in the Object Repository
Use the Object Spy tool
Parameterize tests
Customize checkpoints with parameters and
Data Table formulas
Reuse actions
Run an integrated test scenario
Why Use Automated Testing Tools?
No Testing
Manual Testing
Time consuming
Low reliability
Human resources
Inconsistent
Automated Testing
Speed
Repeatability
Programming
capabilities
Coverage
Reliability
Reusability
Manual To Automated Testing

Perform user
actions
1
Wait for
processes to
complete
2
Verify AUT
functions as
expected
3
Repeat steps until
all applications
are verified
compliant
4
Generate
automated
script
1
Synchronize
script playback
to application
performance
2
Add
verification
3
Run test or
suite of tests
4
Quick Test Professional
QuickTestProfessional(QTP) is Mercury Interactives
functional enterprise testing tool.

QuickTest Professional enables testing of standard
Windows applications, Web objects, ActiveX controls,
Visual Basic applications, and multimedia objects on Web
pages.

Additional QuickTest add-ins can be acquired for a
number of special environments (such as Java, Oracle,
SAP solutions, .NET Windows and Web Forms, Siebel,
PeopleSoft, and Web services).
Features & Benefits of QTP
Complete IDE environment
Smart Object Recognition
Data-drives any object
Comprehensive log reporting
Thorough validation of applications using checkpoints
Handles unforeseen application events using Recovery
manager
Easily integrates with WinRunner test scripts
Operates stand-alone or integrated into Mercury Business
Process Testing and Mercury Quality Center
Testing with QuickTest
All the steps/actions are recorded by QTP.

Graphically displays the steps performed while
recording.

State of the objects under test can be verified.

The test can be modified and enhanced.

Test results for each step in the test can be viewed after
running .
Testing Process in QTP
Testing with QuickTest involves 3 main stages :
Creating,Running & Analyzing
Create Tests
Running Tests
Analyze Test Results
Testing Process in QTP
CREATE TESTS:
Recording a session on a site or application.

Modify the Tests as per the requirements.

Insert checkpoints into the test.

Broaden the scope of the test by replacing fixed values
with parameters.

If applicable add Functional Testing features.
Testing Process in QTP
Running Tests

Run your test to check the site or application.

Run a test to debug the test.

Analyzing Test Results

View the test results in the Test Results window.

Analyze defects detected during the test run.
QuickTest Interface
Starting QuickTest -


QuickTest Interface

The QuickTest Window

QuickTest Interface
Test Pane - Displays your test in the form a of a collapsible, icon based tree
(tree view) or displays each operation performed on your application in the
form of a script (expert view).
Tree View Expert View
QuickTest Interface

Test Details Pane (Active Screen): It provides a snapshot
of the application as it appeared while recording the test.
QuickTest Interface

Data Table & Debug Viewer Pane
Data Table - Assists you in parameterizing your test. The Data Table
contains the Global tab and a tab for each action.
Debug Viewer - Assists you in debugging your test.
QuickTest Interface

File Tool Bar

Test Tool Bar
Debug Tool Bar Action Tool Bar
QTP-Creating Tests
Creating Tests - Designing Tests
Tests scripts can be quickly created by recording
the operations that are performed on a Web site
or application.

Once the test is created it can be enhanced by
using checkpoints and other special testing
options.

Automated Testing: Workflow
Designing of Test
Designing of Test involves the following steps
Planning a Test
Recording a Test
Understanding Your Test
Choosing Your Recording Mode

Designing Tests - Planning a Test
Planning a test involves the following :
Determine the functionality to be tested.
Decide the information that is required during the test.
Evaluate the types of events that needs to be recorded.
Identify the fixed values that needs to be replaced by parameters.
Change the way that QuickTest identifies objects.
Decide on the organization of the object repository files.
Streamline the testing process.
Calls to Functions, if any.

Designing Tests - Recording a Test
QuickTest records each step you perform and generates a test tree
and test script.
Each test includes a single action, but can include multiple
actions.
By default, QuickTest records in the Standard recording mode.
The other modes are analog and low-level recording.
Designing Tests - Recording a Test
QuickTest records each step performed by the user
and generates a test tree and test script.
To record a test:
Open QuickTest
Open a test
o To create a new test, click the New button or choose
File > New.
o To open an existing test, click the Open button or choose
File > Open.In the Open dialog box, select a test and click Open

Click the Record button or choose Test > Record.
Designing Tests - Recording a Test
While recording a new test the Record and Run Settings
dialog box opens.

Designing Tests - Understanding Your Test
While recording, QuickTest creates a test tree a graphical
representation of operations performed on your
Application. The test tree is displayed in the Tree View tab.

Test Tree
Designing Tests - Understanding Your Test
QuickTest also generates a test script a VBScript
program based on the object model. The test script is
displayed in the Expert View as follows:
Designing Tests -
Chosing Your Recording Mode
In the default and normal recording mode, QTP
- Records objects and its operations
- Recognizes the objects in the application regardless
of their location on the screen.

QTP offers two modes of recording for working with
specific types of objects or operations

Analog Recording
Low Level Recording
Designing Tests Analog Recording
Enables you to record the exact mouse and keyboard
operations
Analog recording is relative to application window, if the window
does not move during the recording session
Analog recording is relative to screen, if the window which is
recorded moves or if the operations being recorded is in more that 1
location.

Every movement of the mouse is recorded and tracked.

Useful for recording operations that cannot be recorded at
the level of an object, for example, recording a signature
produced by dragging the mouse.
Designing Tests -Analog Recording
The steps recorded using analog recording are saved in a
separate data file.
This file is stored with the action in which the analog steps
are recorded.
Designing Tests Low-Level Recording
Low level recording can be used on Environments not
supported by QTP

Low level recording can be used when the exact location of
the operation needs to be recorded

Each step recorded in this mode is shown in the test tree and
test scripts

In this mode QTP records all parent level objects as window
test objects and all other objects as winobjects test objects
Designing Tests Low-Level Recording
Low-Level Recording supports the following methods for each test object:
WinObject test objectClick, DblClick, Drag, Drop, Type
Window test objectClick, DblClick, Drag, Drop, Type, Activate, Minimize,
Restore, Maximize
Record and Playback-Exercise


Create a simple script for recording the the following steps
Go to www.newtours.mercuryinteractive.com
Login
Book a ticket for a flight choosing the source and destination
Logout
Save and run the script


How QTP Identifies Objects
How QuickTest Identifies Objects
Quick Test Professional
tests dynamically changing application by learning and
identifying test objects and their expected properties and
values.
Analyzes each object in a application much the same way
that a person would look at a photograph and remember its
details.
If the recorded description does not enable QuickTest to
identify the specified object in a step, and a Smart
Identification definition is defined (and enabled) for the
object, then QuickTest tries to identify the object using
the Smart Identification mechanism .
Test Object & Run Time Object
The Test Object Model is a large set of object types
or classes that it uses to represent the objects in
your application.
A Test object is an object that is created in the test
to represent the actual object in an application.
QuickTest stores information about the object that
will help it identify and check the object during the
test run.
A Run-time object is the actual object in a Web site
or application on which methods are performed
during the test run.
Objects Identification
When an operation is performed on an application
while recording a test, QuickTest:
Identifies the QuickTest test object class that
represents the object on which QTP
performed the operation and creates the
appropriate test object.

Reads the current value of the objects
properties in the application and stores the
list of properties and values with the test
object.
Objects Identification - Example
For example, suppose if clicked on a Find button
with the following HTML source code:
<INPUT TYPE="submit" NAME="Find" VALUE="Find"> .
QuickTest identifies the object that was clicked as a
WebButton test object.
It creates a WebButton object with the logical name
Find, and records the following properties and
values for the Find WebButton:
Managing Test Objects

QuickTest identifies objects in an application
based on a set of test object properties.

It stores the object data it learns in the object
repository

When the property values of objects in the
application change, corresponding test object
property values should be modified so that it
can continue to use existing tests.
Object Repository
Objects can be saved either in a shared object
repository or in per action object repository
In shared object repository mode, one
object repository file for multiple tests can
be used.
In object repository per-action mode,
QuickTest automatically creates an object
repository file for each action in your test.
Understanding the Object Repository Dialog Box
The object repository dialog box displays a test tree of
all objects in the current action or the entire test.
Even when steps containing a test object are deleted
from the test script, the objects
remain in the object repository.

Understanding the Object Repository Dialog Box
The contents of the dialog box are as below
Object Spy
Using the Object Spy, the run-time or test
object properties and methods of any object
in an open application can be viewed.

Use the Object Spy pointer to point to an
object.

It displays the run-time or test object
properties and values of the selected object
in the Properties tab.
How Object Spy captures
Object Spy Dialog Box

QTP-Synchronizing a Test
Synchronization Point

A synchronization point is a statement
in the test script that instructs QTP to
wait for a certain response from the
application during playback, just as a
real user would.
Synchronizing Test
Why is it needed?

If you do not want QuickTest to perform a step or checkpoint until an
object in your application achieves a certain status, you should insert a
synchronization point to instruct QuickTest to pause the test until the
object property achieves the value you specify (or until a specified
timeout is exceeded).

Synchronizing can be achieved by :

- Creating Synchronization Points
- Adding Exist and Wait Statements
- Modifying Timeout Values

How to synchronize a Test
Select the test settings tab in the test settings option and
give the time delay needed for synchronizing
Adding a Synchronization Point
Begin recording the test.
Keep the screen or page in the application active
where synchronization point is required.
In QuickTest choose


Adding a Synchronization Point to an object
Click the object in the application for which
synchronization point is required.
The Add Synchronization Point dialog box opens.
Select the test object property needed for
synchronization.


Synchronization Point
When Sync Point is added it appears as below in the
Tree view and Expert View .
Synchronizing Test- Exist and Wait Statements
Exist and/or Wait statements can be used in the Expert
View to instruct QuickTest to wait for a window to open
or an object to appear.
Wait Statements:
Wait statements instruct to wait a specified amount of
time before proceeding to the next step.
Exist Statements:
Returns a value indicating whether or not an object
currently exists.
Synchronizing Test- Timeouts
What is a Time out?
It is the amount of time QT waits for an object to appear or for a
browser to navigate to a specified page
How to Modify Time out settings?
You can increase the default object - synchronization and browser
navigation timeout values for your test.

If you insert synchronization points and Exist and/or Wait statements
for the specific areas in your test where you want QuickTest to wait a
longer time for an event to occur, you may want to decrease the
default timeouts for the rest of your test.
Synchronization-Exercise
In the sample flight application, create a
script for opening an order, based on order
number and view its details.

Create synchronization point at the
applicable point.


QTP-Check Points
Check Point
A checkpoint is a verification point that compares
a current value for a specified property with the
expected value for that property.

Checkpoints enables the user or tester to identify
whether the website or application being tested
is functioning correctly or not.

Check Points
When checkpoint is added , QuickTest adds a checkpoint with
an icon in the test tree and adds a CheckPoint statement in
the Expert View.

When the test is run , QuickTest compares the expected
results of the checkpoint to the current results.

If the results do not match, the checkpoint fails.

The results of the checkpoint can be viewed in the Test
Results window.
Checkpoints-Types
Standard Checkpoint
Checks value of standard objects property
Eg: Check that a radio button is selected

Image Checkpoint
Checks property value of an image
Eg: Check that the image source file is correct

Bitmap Checkpoint
Checks an area of a Web page or application after capturing it as a
bitmap

Table Checkpoint
Checks information in a table,Eg: Check that the value in a table
cell is correct
XML checkpoint
Checks information in a table
Eg:XML file checkpoints are used to check a specified XML file
Checkpoints-Types
Text Checkpoint
Checks that the text string is displayed in the appropriate place
Eg: checks that the words New York are displayed between
Flight departing from and to San Francisco.

Textarea Checkpoint
Checks that the text is within a defined area in windows application

Accessibility Checkpoint
Checks if the web page conforms to world web consortium(w3c)
guidelines

Page Checkpoint
Checks the characteristics of a Web page,Eg: checks if a Web page
contains broken links

Database Checkpoint
Checks the contents of database
Checkpoints-Types Vs Add-Ins


Web

Std

VB

ActiveX

Multimedia

Other Object

Standard

S

S

S

S

S

NA

Image

S

NS

NS

NS

NS

NA

Table

S

NS

NS

S

NS

NA

Text

S

S

S

S

S

NA

Text Area

NS

S

S

S

NS

NA

Bitmap

S

S

S

S

S

NA

Accessibili
ty

S

NS

NS

NS

NS

NA

XML

S

NS

NS

NS

NS

S(File)

Page

S

NA

NA

NA

NA

NA

Database

NA

NA

NA

NA

NA

S(Db Table)


S - Supported
NS - Not Supported
NA - Not Applicable

Checkpoints-Standard
Standard Checkpoint checks the property value of an
object in an application or Web page.

The standard checkpoint checks a variety of objects such
as buttons, radio buttons, combo boxes, lists, etc.

To set the options for a standard checkpoint, use the
Checkpoint Properties dialog box.

Standard check point can be added while recording or
While editing the test.
Checkpoints-Standard
Adding CheckPoint While Recording
Click the Insert Checkpoint.
Click the object that needs to be checked.
Select the item that has to be checkd from the displayed object tree.
Open the Checkpoint Properties dialog box.
Specify the settings for the checkpoint.
Checkpoints-Standard
Adding Standard CheckPoint while editing the test.
Select the Active Screen button.
Click a step in the test where a checkpoint must be added.
Right-click an object on the Active Screen and choose Insert
Standard Checkpoint.
Select the item from the displayed object tree.
Open the Checkpoint Properties dialog box.
Specify the settings for the checkpoint
Checkpoints-Standard
Standard Checkpoint Properties Dialog Box.


Checking Text

We can check that a specified text string is displayed by
adding one of the following checkpoints to the test.
Text CheckpointEnables checking that the text is displayed in a screen
according to specified criteria. It is supported for all environments.

Standard CheckpointEnables to check an objects text property. This is the
preferred way of checking text in many Windows applications.

Text Area CheckpointEnables to check that a text string appears within a
defined area in a Windows application, according to specified criteria. It is
supported for Standard Windows, Visual Basic, and ActiveX environments.
Note:A text or text area checkpoint must be used when an object does not
have a text-type property.
Checkpoints-Text
In the Text/Text Area Checkpoint Properties dialog
box, we can designate the text to check, as well as
the text preceding and following it.

This is helpful when the text to be checked
appears more than once in the object to check.

It also allows you to check only a part of the
objects text. These features are not available
when checking text with a standard checkpoint.
Inserting Text Checkpoint
To add a text checkpoint while recording:
1. Display the page, window, or screen containing the text to check.
2. Choose Insert > Checkpoint > Text Checkpoint, or click the arrow next to the
Insert Checkpoint button and choose Text Checkpoint.
3. The QuickTest window is minimized and the mouse pointer turns into a pointing
hand.
4. Click the text string for which you want to create the checkpoint.

Inserting Text Checkpoint
5) If the area you defined is associated with more than one
object, the Object SelectionText Checkpoint Properties
dialog box opens
6) Select the object for which
you are creating the
checkpoint.
7)Specify the checkpoint settings.

8)Click OK to close the dialog box. A tree item with a
checkpoint icon is added to your test tree.
Text Checkpoint-Properties
Checkpoints-Page
Checking Web Pages
This checkpoint can check
Statistical information about Web pages
These checkpoints check the links and the images on a Web page
Broken links
Verify HTML Source
Verify HTML Tags

This checkpoint can be accessed by Right clicking on
the Page in the Test tree and choose Insert Standard
Checkpoint.
Checkpoints-Page
Page Checkpoint Properties Dialog Box.
Checkpoints-Tables
Checking Tables
This checkpoint can be used to check that a specified
value is displayed in a cell in a table .
Table checkpoints are supported for
Web
ActiveX applications
For a variety of external add-in environments.

Checkpoints-Tables
Table Checkpoint Properties
Table checkpoint can be
accessed by right
clicking on the table in
the Test Tree and choose
Insert Standard
Checkpoint.

Checkpoints-XML
XML Checkpoint:

It can be utilized to verify the data content of XML files.

We can use an XML checkpoint and parameterize the captured
data values in order to check an XML document or file whose
data changes in a predictable way.

Schema validation can be utilized to check that each item of
content in an XML file adheres to the schema description of
the element in which the content is to be placed.
Checkpoints-XML
XML Checkpoint Properties Dialog Box
Checkpoints-Database
Database checkpoints are used to check the contents of
the databases accessed by Web site or application.
The results of a query on a database are known as a result
set
We can define the query for your checkpoint using
Microsoft Query or by manually entering a database
connection and SQL statement.
When test is run, the database checkpoint compares the
current state to the expected data defined in the
Checkpoint Properties dialog box.
If expected data and current results do not match, the
database checkpoint fails
Database Checkpoints
When test is run, the database checkpoint
compares the current state of the database to
the expected data defined in the Checkpoint
Properties dialog box. If the expected data and
the current results do not match, the database
checkpoint fails.

Checkpoint-Exercises
create a simple record and playback script on the
www.newtours.mercuryinteractive.com site and place a
standard checkpoint in the user id and observe the results.

create a simple record and playback script on the
www.newtours.mercuryinteractive.com site and place a text
checkpoint in the name field while booking a ticket.

Create a page checkpoint in the welcome page of
www.newtours.mercuryinteractive.com and note the results.

S-ar putea să vă placă și