Header Ads

Some Facts regarding QTP

Facts:Spaces—You can add extra blank spaces to your script to improve clarity. These spaces are ignored by VBScript .
Case Sensative-By default, VBScript is not case sensitive and does not differentiate between upper-case and lower-case spelling of words, for example, in variables, object and method names, or constants. Like-Browser("Mercury") and Page("mercury") are same.
WaitProperty can be used for synchronization purposes when an existing object is expected to change some property (e.g., text) or when an object is supposed to be loaded to memory withing a specified timeout.

Now, let's put some order in this topic:

The Exist property (method, if you want) queries the OS if an object is loaded to the machine's RAM and returns True or False. Since it takes a timeout in seconds as argument, it should be used for general synchronization, such as when expecting a dialog to open.
The WaitProperty method queries an object that is already loaded as to the value of a certain property. As with any other object method, if the object is not loaded, then you'll get a warning in the report.
As to the test stopping or not, it depends on your run settings and code.
I conclude that, based on the information you provided, your expectation that QTP must stop the test is unfounded.
It may sound surprising or illogical at first sight, but the native Exist property is not fit to check for the closing of a Dialog, only its opening (and, by the same token, to check for the unloading of any object). The reason is simple: the Exist property keeps searching for the object until the timeout is reached. However, in the case of closing a Dialog we would prefer it to behave differently: as a matter of fact, we would like to ask if Not Exist, get a positive answer and exit the function as soon as possible.

If obj.WaitProperty(, , []) Then

'TODO: Your script implementation


ExitTest 'or ExitAction, etc.

End If
This example is taken from www.advanceqtp.com

Powered by Blogger.