qtp flight reservation application free download
#1

ddddddddddddd rerererr r rere rererrere rere er
Reply
#2
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

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: www ssm id con, www lotarysambad con, w3 edit, tpsrv exe, renilla luciferase reporter, blob fail, professional educators of,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  power plant instrumentation by krishnaswamy pdf free download 3 23,780 10-02-2019, 07:00 PM
Last Post:
  karmakshetra epaper in bengali this week pdf free download 5 12,921 01-02-2019, 11:28 PM
Last Post:
  optical networks by rajiv ramaswami free download 3 11,238 20-11-2018, 07:25 AM
Last Post:
  simple java rmi chat application source code 2 18,985 20-07-2018, 12:08 PM
Last Post: Guest
  free download machine design 2 jbk das book pdf 2 11,018 30-05-2018, 11:39 AM
Last Post: [email protected]
  free download internal combustion engine by mathur sharma pdf 3 9,459 26-12-2017, 10:41 AM
Last Post: jaseela123d
  design of machine elements by jbk das pdf free download 4 11,686 04-12-2017, 03:07 PM
Last Post: jaseela123d
  vlsi textbook pdf by bakshi free download 4 9,520 25-10-2017, 03:02 PM
Last Post: pinky
  veta spoken english books pdf free download 3 2,148 20-09-2017, 07:33 AM
Last Post: Guest
  free download source code for online movie ticket booking in java 2 18,494 15-08-2017, 03:21 PM
Last Post: Morshed

Forum Jump: