Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qtp flight reservation application free download
#1

qtp flight reservation application free download

a) Login Operation In Flight Reservation Application

Function Login (Agent, Password)
SystemUtil.Run C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe , ", C:\Program Files\HP\QuickTest Professional\samples\flight\app\ , open
Dialog( Login ).Activate
Dialog( Login ).WinEdit( Agent Name: ).Set Agent
Dialog( Login ).WinEdit( Password: ).Set Password
wait 2
Dialog( Login ).WinButton( OK ).Click
If Window( Flight Reservation ).Exist(12) Then
Window( Flight Reservation ).Close
Login= Login Operation Sucessful
Msgbox Login
Else
SystemUtil.CloseDescendentProcesses
If Dialog( Login ).Dialog( Flight Reservations ).Exist(2) Then
Dialog( Login ).Dialog( Flight Reservations ).WinButton( OK ).Click
Dialog( Login ).WinButton( Cancel ).Click
End if
Login= Login Failed
Msgbox Login
End if
End Function

b) Open Order In Flight Reservation Application

Function Open_Order(Order_Number)
Window( Flight Reservation ).Activate
Window( Flight Reservation ).WinButton( Button ).Click
Window( Flight Reservation ).Dialog( Open Order ).WinCheckBox( Order No. ).Set ON
Window( Flight Reservation ).Dialog( Open Order ).WinEdit( Edit ).Set Order_Number
Window( Flight Reservation ).Dialog( Open Order ).WinButton( OK ).Click
OrdNum = Window( Flight Reservation ).WinEdit( Order No: ).GetVisibleText()
OrdNum=CInt(OrdNum)
If OrdNum=Order_Number Then
Open_Order= Order_Number& Opened sucessfully
Msgbox Open_Order
Else
Open_Order= Order_Number& Not Opened
Msgbox Open_Order
End If
End Function

c) Update Order In Flight Reservation Application

Function Update_Order(Tickets)
Window( Flight Reservation ).Activate
Window( Flight Reservation ).WinButton( Button ).Click
Window( Flight Reservation ).Dialog( Open Order ).WinCheckBox( Order No. ).Set ON
Window( Flight Reservation ).Dialog( Open Order ).WinEdit( Edit ).Set 2
W1indow( Flight Reservation ).Dialog( Open Order ).WinButton( OK ).Click
Window( Flight Reservation ).WinEdit( Tickets: ).Set Tickets
Window( Flight Reservation ).WinButton( Update Order ).Click
Wait (10)
Message = Window( Flight Reservation ).ActiveX( Threed Panel Control ).GetROProperty( text )
If Message= Update Done Then
Update_Order= Order Updated Sucessfully
Msgbox Update_Order
Else
Update_Order= Order Not Updated
Msgbox Update_Order
End If
End Function

d) Write Function to Count how many Buttons available in FR Window

Function Count_Buttons()
Dim oButton, Buttons, TotButtons, i
Set oButton=Description.Create
oButton( Class Name ).Value= WinButton
Set Buttons=Window( text:=Flight Reservation ).ChildObjects(oButton)
TotButtons=Buttons.Count
Msgbox TotButtons
End Function
Call Count_Buttons()

e) Write Function to Count how many Objects available in FR Window by specified Test Object class

Function Count_Objects(Object)
Dim obj, Objects, TotObjects, i
Set obj=Description.Create
obj( Class Name ).Value=Object
Set Objects=Window( text:=Flight Reservation ).ChildObjects(obj)
TotObjects=Objects.Count
Msgbox TotObjects
End Function
Call Count_Objects( WinRadioButton )
Call Count_Objects( WinButton )
Call Count_Objects( WinEdit )
Call Count_Objects( WinComboBox )

f) Write function to capture all button names one by one from Login Dialog Box



Function Capture_Buttons()
Dim oButton, Buttons, TotButtons, i, myButton
Set oButton=Description.Create
oButton( Class Name ).Value= WinButton
Set Buttons=Dialog( text:=Login ).ChildObjects(oButton)
TotButtons=Buttons.Count
For i= 0 to TotButtons-1
myButton=Buttons(i).GetRoProperty( text )
Msgbox myButton
Next
End Function
Call Capture_Buttons()

1) Verify Login Boundary (Check all the boundary conditions of the Login dialog box. Checks to see if the correct message appears in the error window (Flight Reservation Message)

ApplicationDir = Environment("ProductDir")
ApplicationPath = "\samples\flight\app\flight4a.exe"
If Window("Flight Reservation").Exist(2) Then
Window("Flight Reservation").Close
SystemUtil.Run ApplicationDir & ApplicationPath
Elseif Not Dialog("Login").Exist(1) Then
SystemUtil.Run ApplicationDir & ApplicationPath
End If
Dialog("Login").WinEdit("Agent Name:").Set Datatable.Value ("AgentName",dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set Datatable.Value ("Password",dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
If Dialog("Login").Dialog("Flight Reservations").Exist(1) and Datatable.Value "Status",dtGlobalSheet)="Fail" Then
Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at").Check CheckPoint("Agent name must be at least 4 characters long.")
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Elseif Window("Flight Reservation").Exist(10) and Datatable.Value ("Status",dtGlobalSheet)="Pass" Then
Reporter.ReportEvent PASS,"Login: ","Succeeded"
Else
Reporter.ReportEvent Fail,"Login: ","Combination #" & Datatable.GetCurrentRow & " was not according to Excel file"
End If

2) Verify Cancel Operation (in Login Dialog box, if user selects cancel button, before enter any data after enter data dialog box should be disappeared.)

Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinButton("Cancel").Click
If Dialog("Login").Exist (2) =True Then
Reporter.ReportEvent 1,"sd","Fail"
Else
Reporter.ReportEvent 0,"sd","Pass"
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinButton("Cancel").Click
If Dialog("Login").Exist (2) =True Then
Reporter.ReportEvent 1,"sd","Fail"
Else
Reporter.ReportEvent 0,"sd","Pass"
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4a993af45dcbd506c8451b274d2da07b38ff5531"
Dialog("Login").WinButton("Cancel").Click
If Dialog("Login").Exist (2)=True Then
Reporter.ReportEvent 1,"sd","Fail"
Else
Reporter.ReportEvent 0,"sd","Pass"
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4a993af45dcbd506c8451b274d2da07b38ff5531"
Dialog("Login").WinButton("OK").Click

3) Verify Addition, Subtraction, Multiplication and Division Operations in Calculator Application.

Dim aRes,sRes,dRes,mRes
VbWindow("VbWindow").Activate
VbWindow("VbWindow").VbEdit("VbEdit").Set "10"
VbWindow("VbWindow").VbEdit("VbEdit_2").Set "20"
v1=VbWindow("VbWindow").VbEdit("VbEdit").GetROProperty ("text")
v2=VbWindow("VbWindow").VbEdit("VbEdit_2").GetROProperty ("text")
VbWindow("VbWindow").VbButton("ADD").Click
aRes=VbWindow("VbWindow").VbEdit("VbEdit_3").GetVisibleText
VbWindow("VbWindow").VbButton("SUB").Click
sRes=VbWindow("VbWindow").VbEdit("VbEdit_3").GetVisibleText
VbWindow("VbWindow").VbButton("MUL").Click
mRes=VbWindow("VbWindow").VbEdit("VbEdit_3").GetVisibleText
VbWindow("VbWindow").VbButton("DIV").Click
dRes=VbWindow("VbWindow").VbEdit("VbEdit_3").GetVisibleText
v1=cdbl(v1)
v2=cdbl(v2)
aRes=cdbl (aRes)
sRes=cdbl (sRes)
mRes=cdbl (mRes)
dRes=cdbl (dRes)
If aRes=v1+v2 Then
Reporter.ReportEvent 0,"Res","Addition Passed"
else
Reporter.ReportEvent 1,"Res","Addition Failed"
End If
If sRes=v1-v2 Then
Reporter.ReportEvent 0,"Res","Subtraction Passed"
else
Reporter.ReportEvent 1,"Res","Subtraction Failed"
End If
If mRes=v1*v2 Then
Reporter.ReportEvent 0,"Res","Multiplecation Passed"
else
Reporter.ReportEvent 1,"Res","Multiplecation Failed"
End If
If dRes=v1/v2 Then
Reporter.ReportEvent 0,"Res","Division Passed"
else
Reporter.ReportEvent 1,"Res","Division Failed"
End If

4) Verify state of Update Order Button, before open an Order and after open an Order (in Flight Reservation before opening an order Update

Order button should be disabled after opening an order enabled.)
Option explicit
Dim bo,ao
If Not window("Flight Reservation").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "Gcreddy"
Dialog("Login").WinEdit("Password:").SetSecure "4aa8bce9984f1a15ea187a2da5b18c545abb01cf"
Dialog("Login").WinButton("OK").Click
End If
Window("Flight Reservation").Activate
bo=Window("Flight Reservation").WinButton("Update Order").GetROProperty ("Enabled")
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
ao=Window("Flight Reservation").WinButton("Update Order").GetROProperty ("Enabled")
If bo=False Then
Reporter.ReportEvent 0,"Res","Update Order Button Disabled"
else
Reporter.ReportEvent 1,"Res","Update Order Button Enabled"
End If
If ao=True Then
Reporter.ReportEvent 0,"Res","Update Order Button Enabled"
else
Reporter.ReportEvent 1,"Res","Update Order Button Disabled"
End If

5) Price Consistency, In Flight Reservation (In Flight Reservation, First class price=3*Economy class price and Business class price=2*Economy class price)

Option explicit
Dim n,f,b,e
If Not window("Flight Reservation").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4aa8b7b7c5823680cfcb24d30714c9bbf0dff1eb"
Dialog("Login").WinButton("OK").Click
End If
For n= 1 to 10 step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set n
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").WinRadioButton("First").Set
f=Window("Flight Reservation").WinEdit("Price:").GetVisibleText
Window("Flight Reservation").WinRadioButton("Business").Set
b=Window("Flight Reservation").WinEdit("Price:").GetVisibleText
Window("Flight Reservation").WinRadioButton("Economy").Set
e=Window("Flight Reservation").WinEdit("Price:").GetVisibleText
f=cdbl(mid(f,2,len (f-1))
b=cdbl(mid(b,2,len (b-1))
e=cdbl(mid(e,2,len (e-1))
If f=3*e and b=2*e Then
Reporter.ReportEvent 0,"Res","Pricy Consistancy is there"
else
Reporter.ReportEvent 1,"Res","Pricy Consistancy is NOT there"
End If
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("No").Click
Next

6) Verify Total, In Flight Reservation (In Flight Reservation, Total = Tickets * Price)

Option Explicit
Dim t,p,tot,n
For n= 1 to 10 step 1
If Not window("Flight Reservation").Exist (2) Then
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").Activate
Dialog("Login").WinEdit("Agent Name:").Set "Gcreddy"
Dialog("Login").WinEdit("Password:").SetSecure "4aa892d62c529f1c23298175ad78c58f43da8e34"
Dialog("Login").WinButton("OK").Click
End If
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set n
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click

t=Window("Flight Reservation").WinEdit("Tickets:").GetVisibleText
p=Window("Flight Reservation").WinEdit("Price:").GetVisibleText
tot=Window("Flight Reservation").WinEdit("Total:").GetVisibleText
t=cdbl (t)
p=Cdbl(mid(p,2,len (p-1))
tot=Cdbl(mid(tot,2,len (tot-1))

If tot=t*p Then
Reporter.ReportEvent 0,"Res","Calculation Passed"
else
Reporter.ReportEvent 1,"Res","Calculation Failed"
End If
Next

7) Verify Flight From & Flight To Combo Boxes (In Flight reservation, select an item from Fly From: combo box and verify weather that item available or not in Fly To: combo box, like this select all items one by one in Fly From and verify weather selected items available or not in Fly To.)

Option explicit
Dim qtp,flight_app,f,t,i,j,x,y
If Not Window("text:=Flight Reservation").Exist (7)= True Then
QTP=Environment("ProductDir")
Flight_app="\samples\flight\app\flight4a.exe"
SystemUtil.Run QTP & Flight_app
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "asdf"
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "4aa5ed3daf680e7a759bee1c541939d3a54a5b65"
Dialog("text:=Login").WinButton("text:=OK").Click
End If
Window("text:=Flight Reservation").Activate
Window("text:=Flight Reservation").WinButton("window id:=6").Click
Window("text:=Flight Reservation").ActiveX("acx_name:=MaskEdBox","window id:=0").Type "090910"
f=Window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").GetItemsCount
For i= 0 to f-1 step 1
Window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").Select (i)
x=Window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").GetROProperty ("text")
t=Window("text:=Flight Reservation").WinComboBox("attached text:=Fly To:","x:=244","y:=147").GetItemsCount
For j= 0 to t-1 step 1
Window("text:=Flight Reservation").WinComboBox("attached text:=Fly To:","x:=244","y:=147").Select (j)
y=Window("text:=Flight Reservation").WinComboBox("attached text:=Fly To:","x:=244","y:=147").GetROProperty ("text")
If x <> y Then
Reporter.ReportEvent 0,"Res","Test Passed"
Else
Reporter.ReportEvent 1,"Res","Test Failed"
End If
Next
Next

8) Verify Order No Entry in Flight Reservation. (In Open Order dialog box, Order No object accepts numeric values only.)

If Not window("Flight Reservation").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4aa9ccae3bb00962b47ff7fb0ce3524c1d88cb43"
Dialog("Login").WinButton("OK").Click
End If
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "a"
ord=Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").GetVisibleText
If ord= "a" Then
Reporter.ReportEvent 1,"Res","Order No Object is taking invalid data"
else
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
End If

9) Get Test Data from a Flat file and use in Data Driven Testing (through Scripting)

Dim fso,myfile
Set fso=createobject("scripting.filesystemobject")
Set myfile= fso.opentextfile ("F:\gcr.txt",1)
myfile.skipline
While myfile.atendofline <> True
x=myfile.readline
s=split (x, ",")
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set s(0)
Dialog("Login").WinEdit("Password:").SetSecure s(1)
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Wend

10) Get Test Data From a Database and use in Data Driven Testing (through Scripting)

Dim con,rs
Set con=createobject("Adodb.connection")
Set rs=createobject("Adodb.recordset")
con.provider=("microsoft.jet.oledb.4.0")
con.open "C:\Documents and Settings\Administrator\My Documents\Gcr.mdb"
rs.open "Select * From Login",con
While rs.eof <>True
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set rs.fields ("Agent")
Dialog("Login").WinEdit("Password:").Set rs.fields ("Password")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
rs.movenext
Wend

11) Count, how many links available in Mercury Tours Home Page.

Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Welcome: Mercury").Page("Welcome: Mercury").ChildObjects (oDesc)
NumberOfLinks = Lists.Count()
Reporter.ReportEvent 2,"Res","Number of Links are: "&NumberOfLinks

12) Count, how many Buttons and Edit boxes available in Flight Reservation main window.

If Not window("Flight Reservation").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "Gcreddy"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
End If
Set oDesc = Description.Create()
oDesc("micclass").Value = "WinButton"
Set Buttons = Window("text:=Flight Reservation").ChildObjects (oDesc)
Num_Buttons = Buttons.Count()
Set oDesc1=Description.Create()
oDesc1("micclass").Value="WinEdit"
Set Editboxes=Window("text:=Flight Reservation").ChildObjects (oDesc1)
Num_Editboxes= editboxes.count ()
sum= Num_Buttons+Num_Editboxes
Reporter.ReportEvent 2, "Res","Total Buttons: "& Num_Buttons &"Total Edit boxes: "& Num_Editboxes

13) Verify search options in Open Order Dialog box
(After selecting open order, 3 search options should be enabled and not checked,
After selecting Order No option, other options should be disabled,
After selecting Customer Name, Flight date option enabled and Order No disabled
After selecting Flight date option, Customer Name enabled and Order No disabled)

If Not window("Flight Reservation").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "Gcreddy"
Dialog("Login").WinEdit("Password:").SetSecure "4aa9ed25bc0ebde66ed726ad87d7e991347d8b9c"
Dialog("Login").WinButton("OK").Click
End If
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").Activate
oe=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").GetROProperty ("Enabled")
ce=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").GetROProperty ("Enabled")
fe=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").GetROProperty("Enabled")

oc=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").GetROProperty ("Checked")
cc=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").GetROProperty ("Checked")
fc=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").GetROProperty("Checked")
If (oe=true and ce=true and fe=true) and (oc="OFF" and cc="OFF" and fc="OFF") Then
Reporter.ReportEvent 0,"Res","Pass"
else
Reporter.ReportEvent 1,"Res","Fail"
End If
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
ono=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").GetROProperty ("Checked")
If ono="ON" Then
fd=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").GetROProperty ("Enabled")
ono=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").GetROProperty ("Enabled")
fd=false
ono=false
Reporter.ReportEvent 0,"Res","Pass"
else
Reporter.ReportEvent 1,"Res","Fail"
End If
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "OFF"
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
cn=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").GetROProperty ("Checked")
If cn="ON" Then
ono=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").GetROProperty ("Enabled")
fd=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").GetROProperty ("Enabled")
fd=True
ono=false
Reporter.ReportEvent 0,"Res","Pass"
else
Reporter.ReportEvent 1,"Res","Fail"
End If
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "OFF"
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").Set "ON"
fd=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Flight Date").GetROProperty ("Checked")
If fd="ON" Then
ono=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").GetROProperty ("Enabled")
cn=Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").GetROProperty ("Enabled")
cn=True
ono=false
Reporter.ReportEvent 0,"Res","Pass"
else
Reporter.ReportEvent 1,"Res","Fail"
End If

14) In Login Dialog box, Verify Help message (The message is The password is 'MERCURY')

If Not Dialog("Login").Exist (2) Then
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
Dialog("Login").Activate
Dialog("Login").WinButton("Help").Click
message=Dialog("Login").Dialog("Flight Reservations").Static("The password is 'MERCURY'").GetROProperty("text")
If message="The password is 'MERCURY'" Then
Reporter.ReportEvent 0,"Res","Correct message "&message
else
Reporter.ReportEvent 1,"Res","Worng message "
End If

14) 'Test Requirement: Open 1 to 10 orders in Flight Reservation , Capture Customer names and Export into a Text file

'Test Flow:
'Login Operation
'Open Order Operation and form the Loop to open 1 to 10 Orders
'Capture Cusomer names using GetROProperty Method
'Create File system Object and Open the Text file using the Object and Export Cusomer names
'--
Option Explicit
Dim Order_Number, Customer_Name, objFso, myFile
Set objFso=CreateObject("Scripting.FileSystemObject")
Set myFile= objFso.CreateTextFile ("C:\Documents and Settings\1 RIGHATWAY\Desktop\abcNew.txt",2)
myFile.WriteLine "Cusomer Names"
myFile.WriteLine "--"
If Not Window("Flight Reservation").Exist(3) Then
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4c48590870466b8dc050bbd24e816890c747ccf8"
Dialog("Login").WinButton("OK").Click
End If
For Order_Number= 1 to 10 step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set Order_Number
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Customer_Name = Window("Flight Reservation").WinEdit("Name:").GetROProperty("text")
wait (2)
myFile.WriteLine Customer_Name
Next
myFile.Close
Set objFso=Nothing

15) Count all opened Browsers on desktop and close them all?

Set oDesc = Description.Create()
oDesc("micclass").Value = "Browser"
Set Browsers =Desktop.ChildObjects (oDesc)
NumberofBrowsers = Browsers.Count()
Reporter.ReportEvent 2,"Res","Number of Browsers are: "&NumberOfBrowsers
For Counter=0 to NumberofBrowsers-1
Browsers(Counter).Close
Next

16) Test Requirement: Capturing all Buttons Names from the Login Dialog box and exporting to a Text file
'Pre-requasites:
'gcr.txt

'Test Flow:
'Creating an Automation Object in FileSystem class
'Opening the External Test Data file using the Object
'Creating Collection object and Capturing Button Names using the Object
'Writing Button Names to an External Text file

Dim objFso, myFile, oButton, Buttons, TotButtons
Set objFso=CreateObject("Scripting.FileSystemObject")
Set myFile=objFso.OpenTextFile("C:\Documents and Settings\gcr.GCRC-9A12FBD3D9\Desktop\vindod.txt",2) '1 for Read, 2-Write & 8-Append
myFile.WriteLine "Button Names"
myFile.WriteLine "--"
Set oButton=Description.Create
oButton("micclass").value="WinButton"
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Set Buttons=Dialog("text:=Login").ChildObjects(oButton)
TotButtons=Buttons.Count

For i= 0 to TotButtons-1
myButton=Buttons(i).GetRoProperty("text")
myFile.WriteLine myButton
Next

myFile.Close
Set objFso=Nothing

4) Data Driven Testing using Data Table methods

Datatable.AddSheet "gcreddy"
Datatable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\gcreddy.xls",1,3
n=datatable.GetSheet (3).GetRowCount
For i= 1 to n
Datatable.SetCurrentRow(i)
Invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set datatable("agent",3)
Dialog("Login").WinEdit("Password:").Set datatable("pwd",3)
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next

Example 2):

Datatable.AddSheet "gcreddy"
Datatable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\gcreddy.xls",1,3
n=datatable.GetSheet (3).GetRowCount
For i= 1 to n
Datatable.SetCurrentRow(i)
VbWindow("Form1").Activate
VbWindow("Form1").VbEdit("val1").Set datatable("V1",3)
VbWindow("Form1").VbEdit("val2").Set datatable("V2",3)
VbWindow("Form1").VbButton("ADD").Click
eres= Datatable.Value ("res",3)
ares=VbWindow("Form1").VbEdit("res").GetROProperty ("text")
If eres=ares Then
datatable("res",3)=pass
else
datatable("res",3)=fail
End If
Next

Database Scripts

1) Get Test Data From a Database and use in Data Driven Testing (through Scripting)

Dim con,rs
Set con=createobject("Adodb.connection")
Set rs=createobject("Adodb.recordset")
con.provider=("microsoft.jet.oledb.4.0")
con.open "C:\Documents and Settings\Administrator\My Documents\Gcreddy.mdb"
rs.open "Select * From Login",con
While rs.eof <>True
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set rs.fields ("Agent")
Dialog("Login").WinEdit("Password:").Set rs.fields ("Password")
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
rs.movenext
Wend

2) Exporting Data from a Database to an Excel Sheet

Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.provider="microsoft.jet.oledb.4.0"
con.open"C:\Documents and Settings\admin\My Documents\Gcreddy.mdb"
rs.open"select*from Login",con
Set ex=createobject("Excel.Application")
Set a=ex.workbooks.open("C:\Documents and Settings\admin\My Documents\Gcreddy.xls")
Set b=a.worksheets("sheet1")
i=1
Do While Not rs.EOF
b.cells (i,1).value=rs.fields("agent")
b.cells(i,2).value=rs.fields("password")
rs.movenext
i=i+1
Loop
a.save
a.close

1) Data Driven Testing through an External Excel Sheet

Set myExcel=Createobject("Excel.Application")
Set myFile=myExcel.workbooks.open ("C:\Documents and Settings\admin\My Documents\gcreddy.xls")
Set mySheet=myFile.worksheets("Sheet1")
Rows_Count=mySheet.usedrange.rows.count
For i= 1 to Rows_Count
Agent=mySheet.cells(i,"A")
pwd=mySheet.Cells(i,"B")
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").Activate
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Password:").SetSecure pwd
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").Close
Next



Systemutil.CloseDescendentProcesses

' open application flights
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"

' Login into the application
If Dialog("Login").WinEdit("Agent Name:").Exist Then
Dialog("Login").WinEdit("Agent Name:").Set "Trilaxmi"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
End If

' Booking flight with entering date of flight and from and to journey.
Window("Flight Reservation").ActiveX("MaskEdBox").Type "12/12/07"
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Paris"

'select the flight details
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "Laxmi"

'Book the number of tickets and select the class.
Window("Flight Reservation").WinEdit("Tickets:").Set "3"
Window("Flight Reservation").WinRadioButton("First").Click

'Insert the order for the booked flight
Window("Flight Reservation").WinButton("Insert Order").Click
wait (5)

'Displays the date of journey
Dat=Window("Flight Reservation").ActiveX("MaskEdBox").GetROProperty("text")
'Msgbox Dat

'Displays the fly from place
FF=Window("Flight Reservation").WinComboBox("Fly From:").GetROProperty("text")
'Msgbox FF

'Displays the fly to city
FT=Window("Flight Reservation").WinComboBox("Fly To:").GetROProperty("text")
'Msgbox FT

'To get the Flight number
FNum=Window("Flight Reservation").WinEdit("Flight No:").GetROProperty("text")
'Msgbox FNum

'To get the departure time
DT=Window("Flight Reservation").WinEdit("Departure Time:").GetROProperty("text")
'Msgbox DT

'To get the arrival time
AT=Window("Flight Reservation").WinEdit("Arrival Time:").GetROProperty("text")
'Msgbox AT

'Reserved Tickets
Ticket=Window("Flight Reservation").WinEdit("Tickets:").GetROProperty("text")
'Msgbox Ticket

'Class for traveling
Clas=Window("Flight Reservation").WinRadioButton("First").GetROProperty("text")
'Msgbox Clas

'Cost of Each ticket
Cost=Window("Flight Reservation").WinEdit("Price:").GetROProperty("text")
'Msgbox Cost

'Total Cost of the journey
Total=Window("Flight Reservation").WinEdit("Total:").GetROProperty("text")
'Msgbox Total

'The inserted order is captured
Order=Window("Flight Reservation").WinEdit("Order No:").GetROProperty("text")
'Msgbox Order

'Condition to check the order number inserted
If ((Order>0) And (Window("Flight Reservation").ActiveX("Threed Panel Control").GetROProperty("Text")=("Insert Done..")) Then
Reporter.ReportEvent micPass, (("Details of Booked flight are as follows: date of journey is " &Dat) + ( " Flying from:" &FF) + ( " Flying to:" &FT) + ( " Flight number is:" &FNum)+ ( " departing at:" &DT) +( " arriving at:" &AT) + (" No. of tickets: " &Ticket) + (" Cost of each ticket is:" &Cost) + ( " Total Cost is:" &Total) + ( " The selected Class is:" &Clas) + ( " The inserted order is" &Order)),"Passed"
Else
Reporter.ReportEvent micFail,"order not inserted","Failed"
End If

if window("Flight Reservation").Exist Then
window("Flight Reservation").Close
End IF
Reply

#2
qtp flight reservation application free download

1. Record and PlayBack
(Login to Flight Reservation ,Book one ticket ,Insert Order , Send Fax Order
and close)
systemutil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "venkatesh"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "4c639147ce17debfa9a680adf3fb0a1f7b766d39"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "081310"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinEdit("Name:").Set "venkat"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate "13536 FRA 08:00 AM LON 08:45 AM SR $163.00"
Window("Flight Reservation").WinEdit("Name:").Set "venkat"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order.."
' used regular expression at the below Fax Order.Rht Click on Dialog and make it Fax Order No.* .And check the regular expression
Window("Flight Reservation").Dialog("Fax Order No. 12").ActiveX("MaskEdBox").Type "0809972129"
Window("Flight Reservation").Dialog("Fax Order No. 12").WinCheckBox("Send Signature with order").Set "ON"
Window("Flight Reservation").Dialog("Fax Order No. 12").WinButton("Send").Click
Window("Flight Reservation").Close

2 Descriptive Programming (Login to Flight Reservation)
systemutil.run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "venkatesh"
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "4c63941e33c84ad39b70103970c7fe0f8e429f0f"
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close

3.Capture Screen Shot (using CaptureBitmap)
Login failed at Flight Reservation Application

SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set "venkatesh"
'Desktop.CaptureBitmap "d:\login4.png"
Dialog("Login").WinEdit("Password:").SetSecure "4c0616cda83a5c9f88633cdaff4c044c"
Dialog("Login").WinButton("OK").Click

dialog("Login").Dialog("Flight Reservations").CaptureBitmap "d:\login.bmp"
bexists=Dialog("Login").Dialog("Flight Reservations").Exist(2)

If bexists Then
smsg=Dialog("Login").Dialog("Flight Reservations").GetVisibleText
reporter.ReportEvent micFail,"Login",smsg
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
exittest

End If

4. Reusable Action (Flight Reservation Example)
Action1: (Login with incorrect password and cacel)
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 "4c0616cda83a5c9f88633cdaff4c044c"
Dialog("Login").WinButton("OK").Click
bexists=Dialog("Login").Dialog("Flight Reservations").Exist(2)

If bexists Then
smsg=Dialog("Login").Dialog("Flight Reservations").GetVisibleText
reporter.ReportEvent micFail,"Login",smsg
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click

End If

runaction "Action3",oneiteration

Action2:
msgbox "welcome to action2"

Action3: (Reusable Action) used in Action1 : (Login with correct password)
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 "4c06513879e8c9aae96f878ebd40924cb403de52"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").Close

5. Regular Expression and Parameterization
(Login to Flight Reservation application, insert order and send fax information)
(need to create fax_no in global sheet with fax numbers)
' Use of Regular Expressions and Parameterization
' Insert Order and Send Fax
systemutil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure "4c63b0b0656069024c0d34dd2f5745a7b3780b8a"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "081410"
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate "19138 LON 08:00 AM LAX 08:45 AM AA $102.00"
Window("Flight Reservation").WinEdit("Name:").Set "venky"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order.."
' Rht click on the dialog below and make .* and check the regular expression
Window("Flight Reservation").Dialog("Fax Order No. 21").ActiveX("MaskEdBox").Type DataTable("fax_no", dtGlobalSheet)
Window("Flight Reservation").Dialog("Fax Order No. 21").WinButton("Send").Click
Window("Flight Reservation").Close

6.Shared Object Repository

a.(Record Login to Flight Reservation. Goto--Resouces--Object Repository(File--Export Local Objects).It will save as .tsr file)
systemuti.run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure "4c63bd987f7ea31db67d4ec3760e762a901d3161"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close

How to use it :
Goto--Resources--Associate Repositories--Browse the .tsr file and add it.We can't edit this shared O.R.

b. Goto--Resources--Object Repository Manager--(Objects--Add Objects).File--Save As.It will save as .tsr file

7. How to use Library Functions

a. addition.vbs
Function add
a=20
b=30
c=a+b
msgbox "The addition of a and b is : "&c
End Function

b. multiplication.vbs
Function mul
a=4
b=5
c=a*b
msgbox "The multiplication of a and b is :"&c
end function

(File--Settings--Resources--Browse files)

8.Give different keywords at google and search (used descriptive programming and parameterization)

Set ie=createobject("internetexplorer.application")
ie.navigate("http://google")
ie.visible=true
Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Set DataTable("search_keywords",dtGlobalSheet)
Browser("title:=Google").Page("title:=Google").WebButton("value:=Google Search").Click
Browser("opentitle:=Google").Close

9.Store Results in Excel

Set xl= CreateObject("Excel.application")
set wb=xl.workbooks.open("d:/sample2.xls")
Set ws=wb.worksheets(1)

a=15
b=20

If a>b Then
ws.Cells(1,1).Value ="a is bigger"
ws.Cells(1,2).value="PASS"
Reporter.ReportEvent micDone,"a is bigger", a
Else
ws.Cells(1,1).Value = "b is bigger"
ws.Cells(1,2).value = "FAIL"
ws.cells(1,2).font.bold=true
ws.cells(1,2).font.size=12
ws.Cells(1,2).font.colorindex=50
Reporter.ReportEvent micFail ,"b is bigger" , b
End If

wb.save
wb.close
Set ws=nothing
Set wb=nothing
Set xl=nothing
Reply

#3
qtp flight reservation application free download

Flight Reservation Application comes pre-installed with QTP
Using Flight Reservation , you can book a flight between two cities, even modify or delete and existing booking.
You may also fax a booking to a customer with your custom signature.
Flight Reservation has a Reports and Graphs section which helps analyze the ticket selling trends.
A small number of bookings is pre-populated for any new agent , so that you do not have to create test data.
The application has been designed to help learn all the features provided by QTP.At times , you may find this application buggy but your focus should not be technical accuracy of the application, but on its use as a tool, to learn various features of QTP.
Reply

#4
Flight Reservation Application comes pre-installed with QTP
Using Flight Reservation , you can book a flight between two cities, even modify or delete and existing booking.
You may also fax a booking to a customer with your custom signature.
Flight Reservation has a Reports and Graphs section which helps analyze the ticket selling trends.
A small number of bookings is pre-populated for any new agent , so that you do not have to create test data.
The application has been designed to help learn all the features provided by QTP.At times , you may find this application buggy but your focus should not be technical accuracy of the application, but on its use as a tool, to learn various features of QTP.
Reply

#5
Flight Reservation Application comes pre-installed with QTP
Using Flight Reservation , you can book a flight between two cities, even modify or delete and existing booking.
You may also fax a booking to a customer with your custom signature.
Flight Reservation has a Reports and Graphs section which helps analyze the ticket selling trends.
A small number of bookings is pre-populated for any new agent , so that you do not have to create test data.
The application has been designed to help learn all the features provided by QTP.At times , you may find this application buggy but your focus should not be technical accuracy of the application, but on its use as a tool, to learn various features of QTP.
Reply

#6
An airline reservation system (ARS) is part of the so-called passenger service systems (PSS), which are applications supporting the direct contact with the passenger.
ARS eventually evolved into the computer reservations system (CRS). A computer reservation system is used for the reservations of a particular airline and interfaces with a global distribution system (GDS) which supports travel agencies and other distribution channels in making reservations for most major airlines in a single system.
Reply

#7
To get full information or details of qtp flight reservation application free download please have a look on the pages

http://techtalented.blogspot2012/10/flig...sting.html

if you again feel trouble on qtp flight reservation application free download please reply in that page and ask specific fields in qtp flight reservation application free download
Reply

#8
Hi am Ramesh i would like to get details on qtp flight reservation application free download ..My friend Justin said qtp flight reservation application free download will be available here and now i am living at .. and i last studied in the college/school .. and now am doing ..i need help on ..etc
Reply

#9
download ghggjhgghjgh hjhjf hjfdhjhfd hdghgjg fhdjg ghjghdfg fhfh hfhf hgh gghh hfhh hfh hh hf h hj ghhgfhfh fhfhh juyui ioiuiu uiuyf sgg jyjj gg hhf hfhfh dfgg gfdg gdgdg fghfh jukjuy reer dsfsf hfhf fhhfh hfhfh fhhf dfdfgfd fhfhff fggfh fh.
Reply

#10
To Whom It May concern:

I am learning only Software QA and require the flight reservation application in order to proceed with the course.

could you please send me the free download link.

thank you in advance.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Powered By MyBB, © 2002-2024 iAndrew & Melroy van den Berg.