Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP Value Comparison Error
#1
Hi All,

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"
'Logging in Flight Application
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.
Reply
#2
You may want to format your post, it becomes difficult to wade through all the code written up there. Check forum help https://www.learnqtp.com/forums/misc.php...help&hid=7
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Hi All,

I've solved the problem by replacing CDbl with CCur.

Thanks a lot.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Files comparison using QTP santosh.msr 0 2,590 07-11-2016, 11:38 AM
Last Post: santosh.msr
  XML diff comparison bubblehead 0 6,255 05-21-2014, 12:01 PM
Last Post: bubblehead
  Bitmap Comparison Algorithm by creating Custom comparer remya 1 5,285 01-19-2011, 03:16 PM
Last Post: john
  Issues with comparison indranilgoswamimcb 3 3,861 09-21-2010, 10:26 PM
Last Post: guin.anirban
  Comparison between QTP & TestDirector nareshko 4 7,332 02-06-2008, 02:00 PM
Last Post: lskmuni2000

Forum Jump:


Users browsing this thread: 1 Guest(s)