-->Other Pre-defined Methods

Exist:
This method is used to check a particular object is available or not, if the object is available it returns true otherwise it returns false
Eg: Invoke application “C:\Programfiles\Alerter\Alerter.exe “
If VbWindow (“Login”).exist then
Msgbox “Application launched “
Else
Msgbox “Application not launched “
End if

Reporter.Report Event:
This option is used to define a user defined message to the result window of QTP based on a step passes or failed
Eg1: Reporter.Report event micpass “login step”, “Login Successful”
Reporter.Report event micfail, “Login step”,” login failed”
(OR)
Eg2: Reporter.reportevent micdone, “Login step”, “Login successful”
Reporter.reportevent micwarning, “Login step”, “Login failed”
0 for MicPass
1 for MicFail
2 for MicDone
3 for MicWarning
4 for information

Wait Property (Synchronization point):
This method is used to synchronize the script execution with application execution.
Synchronization is of 2 types
Global Synchronization
Local synchronization

Global Synchronization:
The default value of global synchronization is 20 seconds, which is applicable to entire script, i.e. any step that requires the time less than 20 seconds QTP takes care of it , but if any step requires more than 20 seconds, then we have 2 steps
1.Increase the Global Synchronize value (Not a recommended option).
2.Insert local synchronization point

Steps to edit the Global Synchronization value:
1.Select File -> Settings
2. Click on Run tab
3. Edit the value “Object synchronization timeout” (in seconds)
Eg: Dim App
Set App = Create Object (“Quick test. Application”)
App.Test.Settings.Run.Object Sync Timeout = 10000

Wait property:
In this case the qtp will wait until the defined time gets complete.
Syntax: wait(time is millisec)
Eg: wait(200)

Local Synchronization:
Steps to insert local Synchronization point:
1. Place the cursor where synchronization point needs to be inserted, in the script
2. Ensure that required object /window is available based on whose property synchronization works
3. Click on Record -> Select insert -> Synchronization point
4. Take the hand icon -> Click on Required object window
5. Select the required property and expected value
6. Provide the time value in Milliseconds
7. Click on Apply and OK
Eg: Window (“material”).WaitProperty “Enabled”, True 20000

Note1: The time value in Synchronization point is required, because if there is any problem with object, it will wait for the maximum value given in the synchronization
Note2: If Application is taking less than what is provided in synchronization, script waits for as per application time
Note3: If application is waiting more time than what is provided in Synchronization, then synchronization fails. (Take maximum value in the synchronization as 2 or 3 times than actual value)

Difference between Wait Statement and Synchronization point:
Wait statement simply waits till the amount of the time is relaxed, where as synchronization point works intelligently and wait until the property of the object is matched. Hence we prefer Synchronization point.

Note: With exist method we can give a time like
If window (“Material”).Exist (30), it also works like a synchronization point