Beruflich Dokumente
Kultur Dokumente
5 Tutorials For
Beginners
||| |
||| |
Je will test with the mercury sample application FLIGHT.QTP script consists of things like actions,
functions etc. In QTP 9 we can place 120 actions in a script, this is a limit.Je will begin with a simple test
like the "hello world" program with which we start learning any programming language.
1) First of all click on Record toolbar button ( or Automation menu --> Record or press F3). when we click
on Record, "Record and Run Settings" window opens up. Go to "Jindows Applications" tab and choose
first option "Record and run test on any open windows based application." and click on ok.
2) Open Flight application (Start -->All programs -->QuickTest Professional --> Sample Applications -->
Flight)
3) Type Agent name as "Kumar" (You can enter any, but must be 4 characters or more) and enter
password as "mercury".
4) In the flight reservation window that opens up:a) In the Flight Schedule area, in Date of Flight enter
tomorrow's date in mm/dd/yyyy format.( I used tabs to move to next fields)b)In Fly From enter Denverc)In
Fly To enter Londond) Click on Flights button which is on the right hand side of "Fly To".Let the default
option be selected in the Flights Table.e) Click okf)In the name field enter your name. It will fill rest of the
required information by itself.g) Click on insert order and after the order is insertedh) Click on File --> exit.
5) Now you have recorded your first script. You can click on the expert view tab to see the script which
QTP has recorded for you automatically.
6) Click on run from Automation Menu (or press F5) to open up run dialog box.
7) Go to the "Results Location" tab, and below "write run results to", in "new run results folder" radio
button- let it be the default option --C:Program FilesMercury InteractiveQuickTest
ProfessionalTestsTest1Res1(you can also change it)
8) click on ok.This will run you earlier recorded test and show you the results.But we have to go a long
way. This is just the beginning. ||| |
||| |
'
Checkpoints cannot be added manually, they are inserted using QTP's interface. Results of the checkpoint
can be viewed in the Test Results Jindow.
Checkpoint information is stored in the Local Object Repository. It is in the Resource.mtr file which is in the
action folder (if you created checkpoint in action1 then it will be action 1 folder under the folder in which
you are saving the test/script, if you created checkpoint in action 2 then it will be action 2 folder and so on) .
In the expert view, on any blank line type Checkpoint and put "(". As soon as you put the starting bracket it
will show all the checkpoints you have used in the test.
Now we will start with checkpoints. I will try to show easy to understand example of each and every
checkpoint.
Lets start with simple example of standard checkpoint which checks a variety of objects such as buttons,
radio buttons, combo boxes etc. Standard checkpoints are supported for all add-in environments
Click on the "Flights..." button which is on the Right Hand Side of the "Fly To" combo box in the Flight
application.
It will open "Object Selection - Checkpoint Properties" window (with JinButton:FLIGHT highlighted). Click
ok.
It will open checkpoint properties window. (only one property will be checked in it i.e. 'enabled' with a value
of False.)
Click ok. Click on Stop in order to stop the Recording.
'
| |
1|| ||* |
To see a pass test result:
'
#| |*
To see a Fail test result:
# $*
*
! | - -
'
#| |*
|
- -|
$|
|
$
||| |
||| |
Click on Record. Jhen we click on Record, "Record and Run Settings" window opens up. Go to "Jindows Applications" tab
and choose first option "Record and run test on any open Jindows based application." and click on ok.
Go to Insert (menu)->Checkpoint->Database Checkpoint
A 'Database Query Jizard' opens.
Select ' Specify SQL statement manually' from the Query definition area. Click Next. Click Create.
Go to 'Machine Data Source' Tab
Select Oracle from data source name. Click Ok. It will open 'Oracle ODBC Driver Connect'
It will open 'Database Checkpoint Properties' window with the result of the query. Click Ok.
Click Stop in order to stop the Recording.
In the Expert View, it just adds one line "DbTable("DbTable").Check CheckPoint "DbTable")"
||| |
*
' ((!| * $| | " !
*
* #
*
*| |
,* |
| $|
||| |
Make sure thathttp://www.google.co.in/ is open.(Now only QTP with blank test and www.google.co.in should be open.)
Click on Record. Jhen we click on Record, "Record and Run Settings" window opens up. Go to "Jeb" tab and choose first option
"Record and run test on any open browser." and click ok.
Go to Insert (menu)->Checkpoint->Standard Checkpoint (or press F12).
The mouse pointer will become hand and QTP will be minimized.
Click anywhere on the white space on the Google.co.in page.
It will Open "Object Selection - Checkpoint Properties" window. Click on 'Page : Google' option which has a page icon on left of it
with right corner of the page slightly folded.
Click ok.
A 'Page Checkpoint Properties' window opens up. Let all the options be default. Click ok.
Click on Stop in order to stop the Recording.
In the Expert view it will add just one line:
Browser("Google").Page("Google").Check CheckPoint("Google")
Je will explore this line later on.
I ran this test by opening www.google.co.in in offline mode (not on internet). It recorded the following properties:
Property Name Property Value
load time "0"
number of images "2"
number of links "20"
Here it shows the load time as 0 because I did not open Google at the time of running the test, it was already open.
Jhen you run it, in the results window, on left hand side, it will show (when every option is expanded):
Test Checkpoint-page Summary (where Checkpoint-page is the name with which I saved the test
Run-Time Data Table
Checkpoint-page Iteration 1 (Row 1)
Action1 Summary
Google (This will be the browser)
Google (This will be the Page)
Checkpoint "Google"
If you run this test on www.google.com it may fail.
||| |
Click on Record. Jhen we click on Record, "Record and Run Settings" window
opens up. Go to "Jindows Applications" tab and choose first option "Record and
run test on any open windows based application." and click Ok.
Change the "Checkpoint timeout" at the bottom of the window to 0 seconds, so that we will have no wait
time while running the test.
Click ok.
Click stop to stop recording the test.
||| |
STYLE B
%$&$ (*(
$
|
*
(*
('
| $ ( (
(9; : <
'
(|| #| (J9; 0
( '
#|(<
'
(||
| ( (
; (*(
1| ( % ( | * **
, (*
(
*
' ('
(
||3 || |
|
'
'
1|* | | $; #*
*% ; * (*(
#
|| | * ' (*0($| |*
!0| | *
||| |
#
'
Open a blank test.
Go to My Documents->My Pictures-> Sample Pictures and right click on image
named 'Sunset' and open it with internet explorer.
Now only a new blank test and internet explorer with this image should be open.
Click on Record. Jhen we click on Record, "Record and Run Settings" window opens up. Go to "Jeb" tab
and choose first option "Record and run test on any open browser." and click on Ok.
Go to Insert (menu)->Checkpoint->Standard Checkpoint(or press F12).The mouse pointer will become hand
and QTP will be minimized.
Click on the image which is opened in the explorer.
It will open 'Object Selection Checkpoint Properties' window with Image: Sunset highlighted. Click Ok.
It will Open 'Image Checkpoint Properties' Jindow. In this window just uncheck all the property values like
href, html tag etc and only check last property which is src.
Rest every thing will be default. Click OK.
Click stop to stop recording the test.
In the expert view it will just add one line
Browser("file:///C:/Documents%20and%20S").Page("file:///C:/Documents%20and%20S").Image("Sunset").Ch
eck CheckPoint("Sunset")
If you run it with that image open in internet explorer it will pass. This test is not intelligent enough. It is just
checking that the image in the explorer is in the same location in which it was when the test was recorded
and its name is Sunset. If you change the name of some other picture in that folder to Sunset and run the
test with that it will also pass.
In this way you can test for some or all the properties of the image which it showed in the 'Image
Checkpoint Properties' Jindow.
||| |
' 2
9 |
' J | $( (|| )(J(
( *| (
||| |
#
For this tutorial make sure you completed the Database checkpoint tutorial successfully. Because the
connection we made in that tutorial with the oracle will be used here.
It is very simple to import data from database into Data Table.
Right-click somewhere inside the data table.
Go to Sheet->Import->From Database...
"Database Query Jizard" opens.
Click on the radio button "Specify SQL statement manually".
(make sure that "Maximum number of rows" checkbox is NOT checked)
Click Next
Click Create button.
"Select Data Source" window opens
Click "Machine Data Source" Tab
Select Oracle from there and click ok.
Enter password for oracle in the "Oracle ODBC Driver Connect window"
After entering password when you click on ok, it open "Database Query Jizard" window with 'Connection
string' automatically filled with info like DSN, UID etc.
Enter SQL statement "select * from emp;" in SQL statement Box.
Click Finish and lo the data is there in the data table.
||| |
www.onsoftwaretest.com
||| |
)99<>2
||| |