09-29-2010, 05:40 PM
Hi All,
My following script is giving wrong result for few values. I don't know why?
Script
'Invoking Flight Application
'Logging in Flight Application
'Exit Flight Application
Result
FlyFrom FlyTo Price Total Error
Denver Frankfurt 109.2 327.6
Denver London 112.2 448.8
Denver Los Angeles 124.4 497.6 373.2
Denver Paris 149 596
Denver Portland 161 644
Denver San Francisco162 648
Denver Seattle 187.6 750.4
Denver Sydney 170.8 683.2 512.4
Denver Zurich 133 532
Frankfurt Denver 111 444
Frankfurt London 111 444
Frankfurt Los Angeles 112.2 448.8
Frankfurt Paris 155.6 622.4 466.8
Frankfurt Portland 108.2 432.8
Frankfurt San Francisco 155.6 622.4 466.8
Frankfurt Seattle 143.2 572.8 429.6
Frankfurt Sydney 108.2 432.8
Frankfurt Zurich 143.2 572.8 429.6
Denver Frankfurt 109.2 436.8
Eventhough the values are qual QTP is giving wrong result.
Thanks in advance for your help.
My following script is giving wrong result for few values. I don't know why?
Script
'Invoking Flight Application
Code:
invokeapplication "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Code:
etIteDialog("Login").WinEdit("Agent Name:").Set "mercury"
Dialog("Login").WinEdit("Password:").SetSecure "4c99ce987feff316434aff0696cbb3e08d8d978e"
Dialog("Login").WinButton("OK").Click
Set comboF = Window("Flight Reservation").WinComboBox("Fly From:")
Set comboT = Window("Flight Reservation").WinComboBox("Fly To:")
nbTickets = 3
For i=0 to comboF.getItemsCount-9
Window("Flight Reservation").ActiveX("MaskEdBox").Type "070711"
comboF.Select i
For j = 0 to comboT.GetItemsCount-1
datatable.Value("FlyFrom", dtGlobalSheet) = comboF.GetItem(i)
comboT.Select j
datatable("FlyTo", dtGlobalSheet) = comboT.GetItem(j)
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window ("Flight Reservation").WinEdit("Tickets:").Set nbTickets
strPrice = Window("Flight Reservation").WinEdit ("Price:").GetROProperty("text")
iPrice = CDbl(Right(strPrice,len(strPrice)-1))
datatable("Price", dtGlobalSheet) = iPrice
strTotal = Window("Flight Reservation").WinEdit ("Total:").GetROProperty("text")
iTotal = CDbl(Right(strTotal,len(strTotal)-1))
datatable("Total", dtGlobalSheet) = iTotal
If ( iPrice*nbTickets= iTotal) Then
Reporter.ReportEvent 0, "Check Price", "Flight from: " & comboF.GetItem(i) & " to: "& comboT.GetItem(j) & " is correct."
Else
Reporter.ReportEvent 1, "Check Price", "Flight from: " & comboF.GetItem(i) & " to: "& comboT.GetItem(j) & " is incorrect."
datatable("Error", dtGlobalSheet) = iPrice*nbTickets
End If
datatable.SetCurrentRow (i*comboT.GmsCount)+j+2
Next
Next
'Exit Flight Application
Code:
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
Result
FlyFrom FlyTo Price Total Error
Denver Frankfurt 109.2 327.6
Denver London 112.2 448.8
Denver Los Angeles 124.4 497.6 373.2
Denver Paris 149 596
Denver Portland 161 644
Denver San Francisco162 648
Denver Seattle 187.6 750.4
Denver Sydney 170.8 683.2 512.4
Denver Zurich 133 532
Frankfurt Denver 111 444
Frankfurt London 111 444
Frankfurt Los Angeles 112.2 448.8
Frankfurt Paris 155.6 622.4 466.8
Frankfurt Portland 108.2 432.8
Frankfurt San Francisco 155.6 622.4 466.8
Frankfurt Seattle 143.2 572.8 429.6
Frankfurt Sydney 108.2 432.8
Frankfurt Zurich 143.2 572.8 429.6
Denver Frankfurt 109.2 436.8
Eventhough the values are qual QTP is giving wrong result.
Thanks in advance for your help.