Friday, October 17, 2008

We can parametrize a field easily in keyword view itself..then why " Data Driver " parametrization is required?

I will tell you this with the help of Flight Reservation application itself..

Most of the fields in the Flight Reservation application like Agent Name, Password, Fly from, Fly to....etc.. can be parametrized in the keyword view itself..

But when you try to parametrize the Class of ticket..(that is First / Business / Economy,,and it is option box)

It is not possible to do it in Keyword view..In such case we have to go to Options --> Data Driver.

There it will show you the existing fields that can be parametrized and also you can add new fields, that you need to parametrize like 'class'...

for that what you have to do..

First spy on the class option box...using object spy..and find its name..

then add the same name in the Data driver using 'Add' button..

And continue with the steps to complete the parametrization..

Thanks : Lavanya, Test Manager, Softsmith Infotech.

Tuesday, October 14, 2008

Sample script -2

'To insert a new record and to open and view the same ..
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"
'Inserting a new order
Dialog("Login").WinEdit("Agent Name:").Set "sundar"
Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure "48f47a499eb5b0bd47874d374eaf3616748868f0"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").ActiveX("MaskEdBox").Type "1111111"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate "13544 FRA 12:48 PM LON 01:33 PM SR $168.50"
Window("Flight Reservation").WinEdit("Name:").Set "sundar"
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinButton("Insert Order").Click
'set a synchronization point to wait till the text "Insert order" is visible.
Window("Flight Reservation").ActiveX("Threed Panel Control").WaitProperty "text", 1, 10000
'get the order number to a.
a=Window("Flight Reservation").WinEdit("Order No:").getvisibletext
msgbox "The newly created order no is :" &a
Window("Flight Reservation").WinButton("Button").Click
'Open the newly added record
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
'set the same order no 'a' to open that..
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").set a
wait 2
msgbox "Open the newly created order no :" &a
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").ClickWindow("Flight Reservation").WinButton("Button").ClickWindow("Flight Reservation").WinMenu("Menu").Select "File;Exit"