Single Post

Header

Sunday, September 30, 2012

Examples for Parameterization in qtp



1. What is parameterization in qtp

Testing an application with different types of inputs for the same script.

2. How many ways are there for parameterization in qtp

Parameterization can do in 3 ways

Through Methods

Through Physical Description

Through Check Point

1.How to parameterize through Methods from Keyword View in qtp.

Create Blank TestCase. Goto –>Record .Open ur Flight Reservation application
Action1 :
Do the record for login (Enter Agent Name and Mercury Password).Then the script would be

SystemUtil.Run “C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe”,””,”C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\”,”open”
Dialog(“Login”).WinEdit(“Agent Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure “4c04981da8da89eb8a871793145df8e386047656″
Dialog(“Login”).WinButton(“OK”).Click

Action2 :
Goto insert —>Call to new action and then it would create action2.
Then go for File–>Open Order and give orger number (Ex:5) and ok.Then the script would be

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “5″
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click

Action3 :
Goto insert —>Call to new action and then it would create action3.
Close the Flight Reservation application.Then the script would be

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).Close

Fill the data in the global sheet. Ex:
Make the A name as Login and B name as Password
Give any name (Ex: venkatesh for login and mercury for password)

Fill the data in the Action2. Ex:
Make the A name as Order Number
Give some numbers (Ex: 3,45,8 )

Goto KeyWord View
Action1
Login :
AgentName Set Value
Click on the value.There choose Parameter:DataTable.
Name :Choose Login
Ok
Same thing for password field.
Name :Choose Password
Ok

Action2
Flight Reservation
Open Order
Edit  set “some number” click there
There choose Parameter:DataTable.
Location in the datatable :current action
ok

Now you look into the expert view and see the code .
There automatically code would be change

Goto–Action1–>Right Click–>Action Call Properties–>Run on all rows
Goto–Action2–>Right Click–>Action Call Properties–>Run on all rows

Execute it.

execute it

2.How to parameterize through methods in qtp

Action 1:

SystemUtil.Run “C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe”,””,”C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\”,”open”
Dialog(“Login”).WinEdit(“Agent Name:”).Set DataTable(“Login”, dtGlobalSheet)
Dialog(“Login”).WinEdit(“Password:”).SetSecure DataTable(“Password”, dtGlobalSheet)
Dialog(“Login”).WinButton(“OK”).Click

Action2 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set DataTable(“OpenOrder”, dtLocalSheet)
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click

Action3:

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).Close

Just user need to give inputs in the corresponding GlobalData sheet (Make ‘A’ as Login and ‘B’ as ‘Password’ )in Action2 Sheet (Make ‘A’ as ‘Order No’).

3.Parameterization through physical description example in qtp

Parameterization through physical description Example :

Action1 :

systemutil.Run “C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4a.exe”
Dialog(“Login”).WinEdit(“Agent Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Agent Name:”).Type  micTab
Dialog(“Login”).WinEdit(“Password:”).SetSecure “4c0ba4645292b686779b42c81dd13093544face9″
Dialog(“Login”).WinEdit(“Password:”).Type  micReturn

Action2 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set DataTable(“order_no”, dtGlobalSheet)
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Window(“Flight Reservation”).Activate

Action3 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).WinMenu(“Menu”).Select “File;Fax Order…”
Window(“Flight Reservation”).Dialog(“Fax Order No. 1″).ActiveX(“MaskEdBox”).Type “11111111111111″
Window(“Flight Reservation”).Dialog(“Fax Order No. 1″).WinButton(“Cancel”).Click
Window(“Flight Reservation”).Activate

Action4 :

Window(“Flight Reservation”).Activate
Window(“Flight Reservation”).Close

Goto Global Data Table :
make “A” as “order_no” and enter
1
2
3

make “B” as “fax_no” and enter
Fax Order No. 1
Fax Order No. 2
Fax Order No. 3

Goto Expert Veiw–Action3

rht click on  Dialog(“Fax Order No. 1″) goto object propert1es
goto Fax Order No. 1 click there u will get browse button open
choose DataTable and fax_no and click ok
execute it

No comments:

Post a Comment