Você está na página 1de 114

Getting Started With

QuickTest Professional

CONFIDENTIAL
Introduction

Limited resources

New technologies Tight Deadlines


TESTING TOOLS
QTP
Win Runner
Load Runner
Reduce TCO Work flawlessly
Silk Test

New Business
Processes
13 July 2009
Why Use Testing Tools ?

No Testing Manual Testing Automated Testing


4 Time consuming 4 Speed
4 Low reliability 4 Repeatability
4 Human resources 4 Programming
4 Inconsistent capabilities
4 Coverage
4 Reliability
4 Reusability

13 July 2009
Benefits of Automated Testing
● Fast: Automated tests run significantly faster than human users
● Reliable: Tests perform precisely the same operations each time they
are run, thereby eliminating human error

● Repeatable: You can test how the Web site or application reacts after
repeated execution of the same operations
● Programmable: You can program sophisticated tests that bring out
hidden information
● Comprehensive: You can build a suite of tests that covers every
feature in your Web site or application
● Reusable: You can reuse tests on different versions of a Web site or
application, even if the user interface changes

13 July 2009
About QTP
● What is QTP?

● Quick Test is a graphical interface record-playback automation tool.


Its an easy to use tool compared to WinRunner. Users can create
sophisticated test suites with minimal training

● QuickTest Professional™ is a tool from the Mercury group for


functional test and regression test automation

● Currently we have 9.1 version in the market with more features


compared to previous stable release 8.2, 8.0

● Mercury allows a 14-day trial version so anyone can download and


give a try
● The language used for constructing QTP is C++

13 July 2009
Features available in QTP
● Web Testing:
– To start test scripts over a web application, you have to enable the
Web add-in.
– You can create Web object checkpoints
– You can perform checks on Web page properties, text, and tables.
– You can also perform checks on objects within your application or
Web site, such as images or form elements.
– You can also output property or text values from the objects in your
Web site.
● DataBase Tests:
– You can use this feature to see if data is updated or a record is created
as a result of an operation performed.
– You can create a Microsoft Query using wizard or manually define an
SQL statement.
● Recovery Scenarios:
– Recovery Manager Scenario wizard available in QTP helps you in
defining the next operation to be performed when an error is
encountered.
13 July 2009
Features available in QTP
● Scripting Language
– VB Scripting
● Environment
– Operating Systems: Windows XP, 2000, 98, NT, ME
– Web Technologies: HTML, DHTML, JavaScript
– Browsers: Internet Explorer, Netscape, AOL
– Emerging Technologies: .Net Winforms, Webforms, Web services,
J2EE Web services, XML, WSDL, UDDI
– Terminal Emulators: 3270, 5250, VT100 Server Technologies:
Oracle, Microsoft, IBM, BEA, ODBC, COM/COM+
– Multimedia: RealAudio/RealVideo, Windows Media Player
– Languages: European, Japanese, Chinese (traditional and
simplified), Korean applications (MFC), Visual Basic, Java, ActiveX
– Core Environments: Windows Enterprise Applications: SAP, Oracle,
PeopleSoft, Siebel

13 July 2009
Differences between QTP and WinRunner
● QTP uses VBScript, WinRunner uses TSL (Test Script Language)
● QTP is advanced keyword driven, Winrunner is not
● Scripting can be avoided by expert view, by which Business
● analysts can also easily create test scripts with no programming
code
● Object repository and scripting are in sync
● QTP supports session based recording
● QTP supports ".NET" application, Winrunner doesn't support
● QTP has "Active Screen" support which captures the application, not
available in WR.
● QTP has "Data Table" to store script values, variables which WR does
not have.

13 July 2009
Glance at the Tool

CONFIDENTIAL
Add-In Manager

● QTP Provides ActiveX,


Visual Basic and Web
Add-ins by default.

● Other add-ins available on


purchase are: Java, Dot
Net, Oracle, PeopleSoft,
SAP, Terminal Emulator
etc.

● Tip of the Day is also


available

● Add-in is a repository of
list of standard classes

13 July 2009
Startup Screen
● The startup screen contains
shortcuts to:
● Tutorial on QTP
● Start Recording a New
Script
● Open an Existing script
● Open a Blank script

● Tip of the Day is also


available

● You can disable this screen


by
● using the checkbox
provided.

13 July 2009
Complete View Toolbar: Three segments of toolbars are available and
can be selected from the View Menu

Test details pane: This screen


Test Pane: Contains the QTP Script holds the snapshot of the screen
recorded (Active Screens) when the
recording is done. This helps in
inserting checkpoints and in
walking through the scripts.
Tree View: Gives the script in a Tree
fashion

Expert View: Gives the script in the form of


statements. Knowledge on VBScript will be
helpful to understand this view

Data Table: Holds Debug Viewer: Useful


Parameterized values. while debugging the
script

13 July 2009
Complete View

13 July 2009
Create A Basic Test

CONFIDENTIAL
Create A basic Test
•Set initial conditions
•Record the business process
•Save the Test
•Run the Test
•View the results

13 July 2009
Set the Initial Conditions
•From the Sample applications open the “Mercury Tours
Web-site”.
•Enter the website using following user name and password.
– Username: Training
– Password: mercury

13 July 2009
Record the Business Process
• In the QTP toolbar click on the
Record button. The Record and
Run dialog box appears.
• In that select the Web tab.
• Now check the radio button
saying “Open the following
browser when record or run
session begins.”
• In Browser details mention the
“Microsoft Internet Explorer” in
Type and
“http://newtours.demoaut.com/” in
Address.
• Also check the checkboxes
saying “Do not record and run the
browsers that are already open”
and “Close the browser when the
test is over”

13 July 2009
• In the windows applications tab
check the radio button saying
“Record and run these application
(opened on the session start)”.
• This setting prevents you from
inadvertently recording operation
performed e-performed on
various Windows applications
(such as email) during a recording
session.
• Click OK.

13 July 2009
Save the Test
•Save the test on Windows File System.
•QTP creates an entire structure of files and directories to
support a single QuickTest script for each saved test.

13 July 2009
Run the Test
•Use the „Run‟ button to begin playback from the top of the
test.
•The Run from Step option in the Test menu is used to run
the test from a selected step to the end of the current
action, if running from the Expert View, or to the end of the
test , if running from the Keyword View. Thus it enables us
to check a specific part of the application or to confirm that
a certain part of the test runs correctly.
•The Update Run option in the Test menu is used to
update the Active screens, Checkpoints and the test
object descriptions.
•Select the location of the test result-either a new results
folder or a temporary folder.

13 July 2009
13 July 2009
Viewing the Test Results
•Test results can be stored in their own location (for
documentation) or in a temporary location that is overwritten each
time the test is run (debugging).
•QTP generates the result file for the test cases at the end of test
in the form of XML tree. The result file provides detail regarding
PASS and FAILS counts, error messages, and may provide
supporting information that allows users to determine the
underlying cause of a failure. Frequently, however, users may
need to re-execute the test case and observe the failure directly.
•The three status reviewed in the test result:
– 1) Passes- Shows the count of the objects where the action is
successful.
– 2) Failed – Shows the count of the objects where the action
completely failed.
– 3) Warning- Shows the count of the objects where the action
is completed but not successfully.
13 July 2009
Passed Object

Partially passed object

13 July 2009
Working With Object
Properties

CONFIDENTIAL
Working With Object Properties

•Working with Object Repository


•Using Object Spy
•Highlighting, Locating and Adding New Objects.

13 July 2009
Working With Object Repository
•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.
•There are two types of object repositories:
•Shared object repository
•Per action repository
•Record the test and save it.
•Now from QTP menu bar select „Resources‟>‟Object
Repository‟.
•You can rename the objects in the repository. For that right-
click on the object and from menu select Rename. After
renaming is done click on OK and save the test.
13 July 2009
13 July 2009
Using the Object Spy
•Using the Object Spy, you can view the properties of any
object in an open application. You use the Object Spy
pointer to point to an object. The Object Spy displays the
selected object‟s hierarchy tree and its properties and
values in the Properties tab of the Object Spy dialog box.
• When the application is running, from the QTP toolbar click
on the Object Spy button, Object Spy dialog box appears.
•In the dialog box, click on the pointing finger button, the
cursor changes to pointing finger.
•Now using that click on the object in the application for
which you want to the properties.
•Once this is done, a hierarchy tree of selected object‟s
properties and values appears in the properties tab of the
dialog box.

13 July 2009
13 July 2009
Highlighting, Locating and Adding New Objects In Object
Repository
•Highlighting an Object:
• In the Object Repository, select an object and the click on the
„Highlight in Application‟ button.
• The select object will be highlighted in the Application.

13 July 2009
• Locating the Object In the Object repository:
• In the Object Repository, click on „Locate in Repository‟ button,
the cursor changes to pointed finger. Once you click on the object
in the application, „Select an Object‟ dialog box appears. When
you click OK, the object is highlighted in the Object Repository.

13 July 2009
•Adding new Objects to the Object Repository:
• In the Object Repository, select the „Flight‟ object. Now in the
toolbar click the „Define New Test Object‟ button. The „Define New
Test Object‟ dialog Box appears.
• From the „Environment‟ list, select „Standard Windows‟, from the
„Class‟ list, select „WinButton‟, in the „Name‟ field type „OK‟, in the
„Test Object Details‟ section, click „Value‟ column for the „Text‟
property and type „OK‟.
• Click „Close‟ to close the dialog box. A new object is added under
the „Flight‟ object. Close the repository and save the test and run.

13 July 2009
13 July 2009
Adding Synchronization

CONFIDENTIAL
Adding Synchronization
•Synchronization is a step added to a test that instructs
QuickTest to wait for the state of a property on a particular
object to change before proceeding to the next step in the
test.
•Just like a manual tester will wait for a visual cue to know
when the AUT has completed its processing, we instruct
QTP to wait for a cue prior to moving on to the next step in
the test
•A synchronization point allows the test to pause while an
application process completes, before moving on to the next
step.

13 July 2009
•To add a Synchronization point, while recording a test, from
the QTP menu bar select „Insert‟ > „Synchronization Point‟,
the cursor will change to pointing finger.

13 July 2009
•Once you select Object from the application for
synchronization, „Object Selection: Synchronization Point‟
dialog box appears. In that click „OK‟.
•Now „Add Synchronization Point‟ dialog box appears. In that
set the „Property name‟ and „Property value‟ as the test
requires and click „OK‟.
•This will add a new step saying „Wait Property‟ in your test
action.
• Thus, a synchronization point is added to the application.

13 July 2009
13 July 2009
Adding the Checkpoints

CONFIDENTIAL
What are Checkpoints?
•A checkpoint verifies that expected information is displayed
in a Application while the test is running. You can add eight
types of checkpoints to your test for standard web objects
using QTP.
•QuickTest will compare actual results from the test run with
expected results in our test plan.
•Expected results are based on what was recorded. Actual
results are based on what occurred during playback/test
run.
•If the two values match, the checkpoint passes.
• A single checkpoint can verify one or more values.
•Checkpoints are used to:
– Verify the state of an object.
– Confirm that an application performs as expected.
13 July 2009
Type of Checkpoints
• Bitmap Checkpoint: A check for a bitmap displayed say a logo that
needs to be displayed for a user
• Standard Checkpoint: Use Standard checkpoint to verify state of objects
like a button enabled/disabled, checkbox selected or not.
• Text/Text Area Checkpoint: When a particular text display in a web page
has to be verified. We can insert text checkpoint to verify the text
displayed on a page or specifically between some text/fields
• Database Checkpoint: Can be used to check that database is
appropriately updated when an activity is done on the application.
• XML Checkpoint: User can specify elements, attributes, and/or values to
check. This checkpoint can be inserted over a XML displayed in the
browser or over an XML file available in the system.
• Accessibility Checkpoint: The list of checkpoints that can be applied
over a page by default can be set using this option. A snapshot of
allowed list is provided.

13 July 2009
How to add Checkpoints
● We can add checkpoint while recording the application or after
recording using „Active Screen‟.
● While recording an application, from the QTP menu bar select „Insert‟
> „Checkpoint‟ > select the checkpoint you want to apply.
● A „Checkpoint Properties‟ dialog box appears. Now select the
properties for which you want the checkpoint to work from the list.
Preferably „text‟ property is selected. Uncheck the remain checkbox of
properties. Also check the condition either „Before current step‟ or
„After the current step‟ as required by the application.
● A Operation saying „check‟ is added to the test action.
● The same steps are followed after recording, select the object from the
„Active screen‟ right-click on it and from the menu option select the
„Insert Checkpoint‟ and follow above steps.

13 July 2009
13 July 2009
Adding Regular Expressions
• While we add the checkpoint for the object in the
application, we can set its text property value as a result of
regular expression.
•To do that in the „Checkpoint Properties‟ dialog box, check
the „text‟ property and uncheck all the other properties. In
the „Configure Value‟ pane ensure that „Constant‟ is check.
Now click the „Constant Value option‟ button, a „Constant
Value Option‟ dialog box appears.
•In the „Value‟ textbox enter the required regular expression
e.g. [0-9]+, check the „Regular Expression‟ checkbox. A
message box will pop up, click ok. Now on the dialog box
also click ok.
•The object will not have the text value as the result of the
regular expression.

13 July 2009
13 July 2009
Some Regular Expressions-
Expression Char Description
Period . Matches any single character
Asterisk * Matches zero to any number of
occurrences of the preceding character
Plus + Matches one to any number of
occurrences of the preceding character
Brackets [A-Z][a-z] Matches a range of characters
[0-9] Matches a range of numbers
\w Matches any alphanumeric character
including underscore
\W Matches any non-alphanumeric
character
Digit \d Matches any digit
\d{4} Matches exactly four digits

13 July 2009
Using Parameter

CONFIDENTIAL
Parameterization
• Parameters allow for extensive reusability of an action or a
test. Do the work once and use it many times.
• Note: A parameter is a placeholder for a value that will be
passed to the test during the test run.
• Enhance your test to become data-driven.
• Describe and use multiple parameter types.
• Drive data in multiple iterations.
• Analyze errors during test execution.
• Parameterize a checkpoint.

13 July 2009
Adding Parameters- Create an Output
Parameter
• Record the test for the Flight Reservation Application for inserting a new
order and faxing the order.
• Add synchronization point on the “Insert Done…” progress bar and add
standard checkpoint on the “Fax Order No.” window title bar and its value
is a regular expression (Fax Order No. .*).
• In the Keyword view , select the „Insert Done‟ step and from the Active
screen, right click on the „Order No.‟ field and select „Insert Output Value‟.
• “In the Object Selection- Object Value Properties” dialog box opens, click
OK. The “Output Value Properties” dialog box appears, check the “Text”
checkbox.
• Select the „After Current Step‟ option. Click OK. Ensure that a column
“Order_No_Text_Out” appears in the Data Table.
• Save the Test.

13 July 2009
13 July 2009
Adding Parameters – Parameterize to Accept
the Input Value
• In the Keyword view, under the first occurrence of the „Flight
Reservation‟ select „Name‟ step. Click the „Value‟ column and then click
the „Configure The Value‟ button.
• The „Value Configuration Options‟ dialog box appears. Select the
„Parameter‟ option. In the „Name‟ field, replace the existing value by
„Name‟.
• Ensure that the „Global Sheet‟ option is selected. Click OK.
• In the QTP Window, in the Data Table, in the „Name‟ column, type
“Sam”, “Laurence”, “Catherine” in three rows.
• Save the test.

13 July 2009
13 July 2009
Using a Random Number Parameter
• In the Keyword view, select the „Tickets‟ step. Select the „Tickets‟ step
where the operation is „Set‟. In the „Value‟ column click the „Configure
the Value‟ button.
• The „Value Configuration Options‟ dialog box appears. In the dialog
box, change the parameter type from „Data Table‟ to „Random Number‟.
• Change the Numeric range from „0 to 100‟ to „1 to 10‟.
• Check the „Name‟ checkbox and in the Name field, type „Tickets_Out‟.
• Ensure that the „For Each Action Iteration‟ option is selected.
• Click OK. Save the Test and Run.

13 July 2009
13 July 2009
Building Multiple and Reusable
Actions

CONFIDENTIAL
Benefits of Test Modularity

• Makes code reusable.


• Scripts are easy to maintain.
• Scripts are efficient.
• Saves development time.

13 July 2009
Building Reusable Actions
•There are two types of Reusable Actions:
• Reusable: Action can be used in the local test, multiple times.
• External: These are reusable actions created in another test.
This can be of two types. If a call to an external action is used
the action is read only in the calling test. But, any existing action
can be inserted as a copy of the original action. In this case, we
can modify this copy of the external action in the calling test.
•Record a test and run it to verify that it passes.
•Now right-click on Action1 step and select Action
Properties from the menu.
•Rename the Action if you want and check the checkbox
saying “Reusable Action.” Click OK in the HINT dialog box
and save the test.

13 July 2009
13 July 2009
Inserting Multiple Actions
• Now there are 2 ways of inserting the Multiple Actions:
– Inserting Copy of an Action
• When you insert a copy of an action into a test, the action is
copied in its entirety, including checkpoints, parameterization,
and the corresponding action tab in the Data Table. The action
is inserted into the test as an independent, non-reusable action
• Once the action is copied into your test, you can add to, delete
from, or modify the action just as you would with any other
recorded action. Any changes you make to this action after you
insert it affect only this action, and changes you make to the
original action do not affect the inserted action. You can insert
copies of both reusable and non-reusable actions.
– Inserting Call to an Action
• You can insert a call (link) to a reusable action that resides in
your current test (local action), or in any other test (external
action).
• When you insert a call to an external action, the action is
inserted in read-only format. You can view the components of
the action in the action tree, but you cannot modify them.

13 July 2009
•Steps to Insert a copy of an Action:
– Choose Insert > Copy of Action, right-click the action and select
Insert Copy of Action, or right-click any step and select Action >
Insert Copy. The Insert Copy of Action dialog box opens.
– Type a meaningful name for the action in the New action name
box and give action description
– Specify where to insert the action : At the end of the test or After
the current step.
– Click OK. The action is inserted into the test as an independent,
non reusable action.
•Steps to insert call to an Action:
– Choose Insert > Call to Action, right-click the action and select
Insert Call to Action, or right click any step and select Action >
Insert Call. The Insert Call to Action dialog box opens.
– In the Select an action box, select the action you want to insert
from the list.
– Specify where to insert the action : At the end of the test or After
the current step.
– Click OK. The action is inserted into the test as a call to the
original action
13 July 2009
Insert Call to Copy of Action

13 July 2009
Insert Call to Existing Action

13 July 2009
Using Local And Global Data Sheets
•There are two types of sheets in any QTP, they are:
•Global sheet
•Local sheet
•Global sheet: Global sheet is unique. Global sheet is used in
order to store values in the sheet and the values stored in
Global sheet can be used in all the actions.
•Local sheet: Each and every action in the script will have its
own Local sheet, name of the Local sheet of a particular action
is same as the action name.
•You can also import and export external excel sheets.

13 July 2009
• Two Different Actions referring the same Global data sheet.

13 July 2009
13 July 2009
•Two Different Actions referring their individual Local data sheets

13 July 2009
13 July 2009
Adding Steps Without
Recording

CONFIDENTIAL
Adding Steps without Recording
•We can add steps to the Test without recording the
application.
•Following steps help us to know how to add steps without
recording taking the example of Login Window of Flight
Reservation System:
• Operate on Login window
• Add Objects to Object Repository
• Verify that Login Window exists.
• Insert a Report Step
• Set the Else Statement (Using Step Generator)

13 July 2009
Operate on Login window
•From the QTP menu bar, select „Insert‟ menu and in that
select „Conditional Statement‟. Select „IF…THEN‟
statement which added to Keyword view.
•In Keyword view, in „Item‟ column select „Statement‟ step,
it changes to list. Select „Object from Repository‟. The
„Select Object For Step‟ dialog box appears. Leave that
open.

13 July 2009
13 July 2009
Add Objects to Object Repository
•Open the Login Window of Flight Reservation application.
•In the „Select Object for Step‟ dialog box, click the pointing
finger button.
•Using the pointing finger cursor click on the Login window.
The „Object selection‟ dialog box appears. Click „OK‟. This
adds Login object to the Repository tree in „Select Object
for Step‟ dialog box.
•Repeat the above step for AGENT NAME, PASSWORD
and OK button.
•Verify that all objects added appear in the object repository
tree in the „Select Object for Step‟ dialog box.
•In the Object Repository tree, select Login Window object
and click OK. The object will be added to the IF statement
in Keyword view.
13 July 2009
13 July 2009
13 July 2009
13 July 2009
Verify That Login Window Exists
•In Keyword View, select Login Object. In the „Operate‟
column, change the operation from „ACTIVE‟ to „EXIST‟.
•From QTP menu bar select „Insert‟ and from there select
„New Step‟ to add new step.
•From the list select „Agent Name‟ and in its Value column
type your First name.
•Repeat the above two steps for „Password‟ and enter
„mercury‟ as value.
•From QTP menu bar again select „Insert‟ and from there
select „New Step‟ to add new step.
•From the list select „OK‟ button to add it.
•Save the test and run it. The test passes.

13 July 2009
13 July 2009
Insert a Report Step
•In Keyword view, select OK step.
•From QTP menu bar, select „Insert‟ and in it select
„Report‟. The „Insert Report‟ dialog box appears.
•In this dialog box, from status list select „Passed‟.
•In the „Name‟ field, type „Login Window Found‟.
•In the „Details‟ field type „The Flight Reservation
Application Login Is Successful.‟ Click OK and close the
„Flight Reservation System‟ application and open it again
but do not login.
•Save the Test and Run.
•View the test results and see how „Reporter Event‟ reports
the test status.

13 July 2009
13 July 2009
13 July 2009
Report in the Test Results:

13 July 2009
Set the Else Statement (Using Step Generator)
•We are preparing a case in which Login window is not found
using the „Else‟ statement.
– In the Keyword View, select the „If‟ statement. From the QTP
toolbar select „Insert‟ > „Conditional Statement‟ > „Else‟. The „Else‟
statement appears at the end of the test. Click the „Else‟ statement,
the step changes to list.
– Select the „Step Generator‟. The „Step Generator‟ dialog box
appears.
– From the „Category‟ list, select „UtilityObjects‟. From the „Object‟ list,
select „SystemUtil‟. From the „Operation‟ list, select „Run‟.
– In the „Argument‟ section, select the „File‟ row. In the „Value‟
column, type the absolute path of the „Flight Reservation‟
application: “C:\Program Files\Mercury Interactive\QuickTest
Professional\Samples\Flight\App\Flight4A.exe” and click OK.
– From the QTP toolbar, select „Insert‟ > „New Step‟, a new step is
added. From the list, select „Object Repository‟. The „Select Object
For Step‟ dialog box appears.
13 July 2009
• From the object repository tree, select „Login‟ window object and
click „OK‟.
• Follow same steps for „Agent Name‟ and „Password‟ and their
respect value columns type „Training‟ and „mercury‟.
• Also add the „OK‟ step by following the same steps. Ensure that
these steps are added as the steps in the „Login‟ window.
• Close the Dialog box and save the test. Run the test and view the
results. Verify that the „Else‟ statement is executed.

13 July 2009
13 July 2009
13 July 2009
13 July 2009
13 July 2009
The ‘Else’ Statement is executed here.

13 July 2009
Creating A Custom
Checkpoint

CONFIDENTIAL
Creating A Custom Checkpoint
• Record the test for inserting new order. From the Keyword View, select
the „Tickets‟ step that has the „Set‟ in the „Operation‟ Column.
• To create an output step for the no. of flight tickets, in the Active Screen,
right click the „Tickets‟ field highlighted. Select the „Insert Output Value‟.
The „The Object Selection- Output Value Properties‟ dialog box appears.
Click OK. The „Output Value Properties‟ dialog box appears.
• Check the „Text‟ checkbox and click „Modify‟. The „Output Option‟ dialog
box appears. In the „Name‟ field type “NTickets”. Click OK to close the
„Output Option‟ dialog box.
• Select „After Current Step‟ option. Click OK to close the „Output Value
Properties‟ dialog box.
• Verify that:
– A „Tickets‟ step appears in Keyword View that has the „Output‟ value in the
„Operation‟ column.
– A Column named „Ntickets‟ appears in the „Global‟ sheet of „Data Table‟.
• Follow the above steps for „Price‟ and „Total‟ fields in the Active screen
and create output parameter name „NPrice‟ and „NTotal‟ respectively.

13 July 2009
13 July 2009
• Now in the Data Table, double-click the fourth column without a name, the
„Change Parameter Name‟ dialog box appears. In the „Data Column Name
Field‟, type „PriceChk‟. Click OK. The new column appears in the Data
Table. Add the values to the „NTickets‟, „NPrice‟, & „NTotal‟ column as 1, 123
, 123 respectively. In the first row of the „PriceChk‟ column type the formula
„=round(a1*b1,2)=round(c1,2)‟
• To perform the calculation press „Enter‟. The „True‟ value appears in the
„PriceChk‟ column. And if you change the „NTickets‟ value to 2, the „False‟
value appears in the „PriceChk Column‟.

13 July 2009
• Now in the Keyword view, select the „Total‟ step that has „Output‟ value in
the „Operation‟ column. From the QTP menu bar, select INSERT > STEP
GENERATOR. The „Step Generator‟ dialog box appears.
• In the Category List, select „Utility Objects‟. In the Object list, select „Data
Table‟. In the Operation list, ensure that the „Value‟ is selected. For the
ParameterId field, click in the „Value‟ column and type „PriceChk‟.
• „Ensure that the „Return Value‟ checkbox is checked. In the „Return Value‟
field, type „vPriceChk‟. Click OK to insert this step into test.
• From QTP menu bar, select „Insert‟ > „Conditional Statement‟ > „If…Then‟
• Click the „Value‟ cell of this step and overwrite „True‟ with „vPriceChk=
“True” ‟. Insert a Report to check the status of this step.

13 July 2009
13 July 2009
Adding A Database
Checkpoint

CONFIDENTIAL
Adding a Database Checkpoint
• Record a new test for inserting an order and add synchronization and
custom checkpoint as discussed before for the „Order No.‟ field and „Tickets‟
field and name the checkpoint as „GUIOrder_No.‟ and „NTickets‟ respectively.
• Now from the Keyword view, select the „Tickets‟ step that has „Output‟ value
in the „Operation‟ column. From the QTP menu bar, select „Insert‟ >
„Checkpoint‟ > „Database Checkpoint‟. The „Database Query wizard‟ opens.
• In the „Query Definition‟ section, ensure that the „Create Query Using
Microsoft Query‟ is selected. Check the „Maximum No. Of Rows‟ checkbox.
Set it to 5. Ensure that „Show Me How to Use Microsoft Query‟ checkbox is
checked. Click Next. In the „Instruction for Microsoft Query‟ dialog box, click
OK.
• In „Choose the Data Source‟ select „QT_Flight32*‟. Ensure that „Use the
Query Wizard‟ checkbox is checked. In the „Query Wizard- Choose Columns‟
dialog box, in the „Available Tables and Columns‟ list, double-click the
„Orders‟ table to display all columns. Select „Order_Number‟,
„Tickets_Ordered‟ and „Agents_Name‟ columns and use right arrow button to
add. Click Next. Again Click Next. Then for sort order use „Order_Number‟.
Also select „Ascending‟. Click Next. And then click Save Query. Ensure that
the „Exit and Return To QTP‟ option is selected.
• Click Finish.

13 July 2009
Continue…
13 July 2009
13 July 2009
Creating test on Web Application

CONFIDENTIAL
Creating Test on Web Application

• Enabling the Web Add-in


• Specifying the Record and Run Settings
• Working with Web Objects
• Specifying Time Out for a Web Page
• Inserting Standard and Test Checkpoint in a Web
Page
• Using Parameters

13 July 2009
Enabling The Web Add-in
• Open the QuickTest Professional and in its Add-in Manager select
„Web‟ add-in.
• Or you can also do this. Select blank test. From the „File‟ menu select
„Settings‟ > „Test Setting properties‟ > click „Modify‟
• A „Modify Associated Add-in‟ dialog box appears. Select „Web‟ add-in
and click „OK‟.

13 July 2009
13 July 2009
Specifying the Record and Run Settings

• From QTP menu bar, click on „Record‟. A „Record and Run Settings‟
dialog box appears.
• In that, in „Web‟ tab, click the radio button saying „record and run test
on any open browser. Click „OK‟.

Note: As a best practice, before you start recording on a browser, close


other browsers and applications and set the record and run settings.

13 July 2009
13 July 2009
Working with Web Objects
• A Web application uses Web classes and Web objects whereas a Windows-
based application uses windows object classes and objects. In addition,
• A Web application uses a greater variety of objects as compared to a
Windows-based application. Some examples of Web objects are hyperlinks,
images, and frames.
• From the QuickTest Professional menu bar, select RESOURCES → OBJECT
REPOSITORY to identify the Web objects used in a Web application.

13 July 2009
13 July 2009
Specifying Time Out For a Web Page
• From QTP menu bar, select „File‟ > „Settings‟.
• A „Test Settings‟ dialog box appears. In the „Web‟ tab, in the text box naming
„Browser navigation timeout:‟ set the required timeout for the webpage. Click
„OK‟.

13 July 2009
Inserting Standard and Text Checkpoint
• Record a test on Web Application “Mercury Tours Web site”.
• In the Keyword View, select the „passCount‟ step that as „4‟ value in
the value column.
• From the QTP menu bar select „Insert‟ > „Checkpoint‟ > „Standard
Checkpoint‟. The „Checkpoint Properties‟ dialog box appears.
• In that, check „All Items‟ checkbox and uncheck the remaining
checkboxes.
• Also select the „After Current Step‟ option. Click „OK‟.
• In Keyword view again, select the „Flight Confirmation: Mercury‟ step.
• In „Active Screen‟, highlight the „Your Itinerary Has Been Booked!‟ text
and right-click on the text.
• Select „Insert Text Checkpoint‟. The „Text Checkpoint Properties‟
dialog box appears.
• Ensure that the „Before Current Step‟ option is selected. Click ok.
• Run the test and view the results.

13 July 2009
• Inserting Standard Checkpoint

13 July 2009
• Inserting a Text Checkpoint

13 July 2009
Using Parameters
• In the Keyword view, click the „Value‟ property of the „FromPort‟ step. The
„Configure the value‟ dialog box appears. Click the „Configure the
value‟ button.
• In the „Value Configure Option‟ dialog box, select „Parameter‟ option.
In the „Name‟ field type „fromCity‟. Click „OK‟.
• Repeat the above two steps for the „ToPort‟ step and name the
parameter as „toCity‟.
• In the respect column of data table enter the values for „fromCity‟ and
„toCity‟ that are found in the list in application.
• Save the test and run. View the test results and the test should pass.

13 July 2009
13 July 2009
13 July 2009
13 July 2009

Você também pode gostar