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"

Sample script

'Below script is used to crosscheck the total price of the ticket
'SystemUtil.Run used to open any application

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"'Login
Dialog("Login").WinEdit("Agent Name:").Set "sundar"'
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "48f2fbefd576dce0d7d715a825e5f31fede59a60"
Dialog("Login").WinEdit("Password:").Type micReturn'book ticket
Window("Flight Reservation").ActiveX("MaskEdBox").Type "1111111111111111"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "sundar"
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
'parameterize the ticket using data table.
Window("Flight Reservation").WinEdit("Tickets:").Set DataTable("Tickets", dtGlobalSheet)
d=Window("Flight Reservation").WinEdit("Tickets:").getroproperty("text")
msgbox "Number of tickets " &d
Window("Flight Reservation").WinButton("Insert Order").Click
a= Window("Flight Reservation").WinEdit("Price:").getroproperty("text")
msgbox "Price per ticket is " &a
b= Window("Flight Reservation").WinEdit("Total:").getroproperty("text")
msgbox "Total calculated in the application " &b
c= a*d
msgbox "Total calculated" &c '
'After splitting
f=split(b,"$") '$ symbol will not come in our calc..so to split the $ using the split command.
msgbox "After splitting the result" &f(1)
h=cdbl(f(1)) ' cdbl used to round off the value..
msgbox "Total price we calculated" &h
If h=c Then
msgbox "Total price is correct "
else
msgbox "Total is incorrect"
End If
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"

Monday, October 13, 2008

Where Regular Expression will be used?

In QTP, delaing of Regualar Expressions and varing object descriptions can be handled by using Descriptive Programming.

Ex. of using Regular expression is:

u just record yahoo login operation and click on Inbox link.
Assume u got 10 new mails, then it shows like Inbox(10).
Read one mail, now it shows like Inbox(9). Now try to play
the recorded script. It wont work. Now use Regular
expression in Inbox link like:

"Inbox.*". At that time it wil work.

Sunday, October 12, 2008

Frequently used Shorcuts

single quotes to comment a line..

'single quotes is used to comment a line.


To Rename a action press F2


Object properties - Ctrl + Enter


Friday, October 10, 2008

3 Types of Recording

1. Normal

2. Analog

3. Low level

Why QTP automation tool ?

From the name itself you can understand, that it is 'Quick test'.

And also it is called as Record and play back tool.

For the first time, you record every thing and play it.

To know the advantage of QTP i am stating you an example below,

Let us say 100 test cases were given to you for testing the login page.

If you are going to do it manually, how long will it take...

depends on the testers capability..

let us assume 5 hrs to 8 hrs.. i.e a day.

The same thing if we automate with QTP, it is a very simple process..

Record the login page once..

Parametrize the user name and password with test case data and Run.

we can finish it up to max of 10 to 20 mins.

" The difference i stated above exclude Data preparation for test cases. "