Ex1: 'Exist Property for General Error handling
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 "4ec473345f54155ecd0b74c636319eac15680767"
Dialog("Login").WinButton("OK").Click
End If
For i = 1 to 10
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Next
Ex2: Error Handling
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 "awf"
Dialog("Login").WinEdit("Password:").SetSecure "4edc29887197ea3b5b141e675c1aaa5549445773"
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
Msgbox "Test Passed"
Else
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
End If
Dialog("Login").WinButton("Cancel").Click
Msgbox "Test Failed"
End if
Ex3: 'Not to use
On Error Resume Next
Dim num1, num2 , sum
num1=100
num2-200
sum= num1+num2
Msgbox sum
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 "4ec473345f54155ecd0b74c636319eac15680767"
Dialog("Login").WinButton("OK").Click
End If
For i = 1 to 10
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button_2").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set i
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Next
Ex2: Error Handling
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 "awf"
Dialog("Login").WinEdit("Password:").SetSecure "4edc29887197ea3b5b141e675c1aaa5549445773"
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
Msgbox "Test Passed"
Else
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
End If
Dialog("Login").WinButton("Cancel").Click
Msgbox "Test Failed"
End if
Ex3: 'Not to use
On Error Resume Next
Dim num1, num2 , sum
num1=100
num2-200
sum= num1+num2
Msgbox sum
No comments
Post a Comment