02-19-2012, 04:41 PM
I have an application which has a list and it contains a specific value. However, this value might not show up right away, so QTP has to wait up to 5min if the value comes. List might contain other values, but QTP will ignore them and try to wait this one specific value to show up. It also has to check every 60 seconds if the value has shown up or not. If the value doesn't show after 5min, the test will fail. So far I don't have a success with this case and I believe this forum has more smarter people than I am.
This example is for Flight demo in QTP:
---------------
'Add username
'Add password
'If the value is not correct, then check the value 5 times
'Verify the value in username field is "test2", if the value is correct, then click "OK" button
'Exit loop
'if value is not correct, wait 1min and try again
---------------
And before anyone says: I know that this case doesn't make any sense in Flight Demo (it will/should fail after 5min because the value is not correct), but I just want to understand how this is made. At the moment I can't even run the script.
This example is for Flight demo in QTP:
---------------
'Add username
Code:
Dialog("Login").WinEdit("Agent Name:").Set "test"
wait 2
Code:
Dialog("Login").WinEdit("Password:").SetSecure "4f40ca43f5ea941e580ed802a32e35c74d81d6ce"
wait 2
'If the value is not correct, then check the value 5 times
Code:
For i = 1 to 5
Code:
if Dialog("Login").WinEdit("Agent Name:").Check CheckPoint("test2") = True Then
Dialog("Login").WinButton("OK").Click
Exit For
'if value is not correct, wait 1min and try again
Code:
else
wait 60
Next
End if
And before anyone says: I know that this case doesn't make any sense in Flight Demo (it will/should fail after 5min because the value is not correct), but I just want to understand how this is made. At the moment I can't even run the script.