Initial development of automated tests with QTP is
usually done by record-and-playback. A user’s actions are captured via
Microsoft’s Component Object Model (COM). These are recorded into Actions, a
kind of subroutine, as VBScript commands. All manipulated objects that QTP
recognizes are also added to the object repository. Once recorded, the scripts
are editable in either Keyword View or Expert View.
After clicking on the playback button all these
actions will be played back. During playback, QTP attempts to identify and
perform operations on the same objects, again using COM.
Recording
Modes: There are three recording modes in QTP
Normal
Analog
Low
Level
NormalRecording Mode: It records the actions performed by the
user on the application objects like Edit boxes, List boxes and Links. QTP
records each action as one step in the QTP script. Step is nothing but one line
in the code.
·
Launch QTP
·
Create a new test by selecting File>New>Test
·
Click Record button or select
Automation>Record or press the Record command shortcut key F3.
·
The Record and Run settings dialog opens as shown below,
Enter Application URL in the box as shown in our case .When you are done with recording click the Stop
button or select Automation>Stop or press F4.
·
Save Your Test.
·
Run the test by clicking Run.
AnalogRecording Mode: This mode enables you to record the
exact mouse and keyboard operations you perform in relation to either the
screen or the application window. This mode is useful when you want to record
mouse movements, for example recording a signature or drawing performed by
dragging the mouse. To record in analog mode , first start normal recording
then select Automation>Analog Recording. The Analog recording dialog box
opens up as shown below.
Record
relative to the screen: QTP records any mouse movement or
keyboard input relative to the top
left
coordinates of your screen(i.e. desktop).
Record relative to the following window:
QTP records any mouse movement or keyboard input
relative to
the coordinates of the specified window.
Low
Level Recording:
Low level
recording mode is used only when exact coordinate of the operation is
essential. To record a test using low level recording mode, start the normal
recording session then select Automation>Low Level Recording to start
recording in low level
(code created in low level recording)
Window("Oracle VM VirtualBox
Manager").Window("Create New Virtual
Machine").WinObject("Cancel").Click 40,17
This code states that Cancel button was clicked
at coordinate 40,17. This coordinate is
measured by taking top left corner of the object( Here it is the Cancel button)
as reference (0,0).
Use Analog recording mode only when normal recording
mode does not accurately record your operations.
Use analog recording for the applications in which
the actual movement of the mouse is what you want to record, like drawings,
signatures etc.
Use low level recording when you need to record the
exact location of the operation on your application screen.
Running
Tests:
QTP always run from the first step, unless you
specify otherwise.To run a test , open it and select Automation>Run or press
F5.The Run dialog box opens, in the dialog box specify the result location.
Temporary run result folder saves run results in a temporary folder.This option
overwrites any results previously saved in this folder. Click OK to start the
Run session.
Test Result Window: When a run session ends, you can
view run session results in the Test Results window. The run result tree is
located in the left pane in the Test Result window
Recordand Run Settings Dialog: This Dialog box is used to
instruct QTP , which application to open when you begin to record or run your
test.
WindowsApplication Tab: As shown in figure below.There are two
radio buttons, if we select first one QTP records and run test on any
application and if we select a second one, we can specify the applications on
which QTP should record or run test.
Web Tab: Web Tab as
shown below also have two radio buttons, if select the first one,QTP records
and run test on application opened on any browser and if we select the second
one, QTP records and runs tests by opening application in a new browser of the
specified type.
No comments:
Post a Comment