Synchronization Point instructs QTP to pause until an object property achieves a specific value.
We use “Synchronization Point” to maintain the time
coordination between testing process and our application process.
Basically there are 4 ways
“sync” is
more dynamic than wait. In wait we have to wait for specified time even if the
process has been completed in less time but with “sync” the page will move on
after completion of a process. It is very good to apply but unfortunately we
can’t apply it in desktop application.
Example:
Browser("Google").Page("TV9
Network, Telugu").Sync
This statement instruct QTP to stay (waits) on the
same page for specified 'n' seconds even though process has occurred in less
than n seconds
we can apply “wait()” by editing the code manually
in expert view after a test is recorded.
Example:
For Web Application: wait(10) ….. it will stay on
the same page for 10 seconds
For Desktop Application: same as above
3)
Wait Property
Syntax:
Browser("Browser").Page("Page").WebElement("WebElement").WaitProperty
"property name", property value, timeout(time in milliseconds)
For Desktop:
Window("Window").WinObject("Window
Object").WaitProperty property name", property value, timeout(time in
miliseconds)
Here wait
property contains 3 things as you can see above, the Property Name list contains
the test object properties associated with the object. Select the property
which you want to use for the Synchronization Point.
Next comes the Property value for which QTP should
wait before continuing to the next step in the test.
Then enter the Synchronization Point timeout (in
milliseconds) after which QTP should continue to the next step, even if the
specified property value was not achieved or if the specified value was
achieved in less time even then it will wait for the specified milliseconds.
How to Apply: Synchronization point can be added
while recording without writing any code from “Insert Synchronization point” it will open your web
page,
ü here
click the object “object selection –
Synchronization Point”
ü pop
up opens here
ü select
the object
ü after
clicking on any object “Add Synchronization Point” pop up opens
ü Here
select property name, enter property value and timeout.
We can also add wait property by editing in expert
view after a test is recorded.
Example:
For web Application:
Browser("Google").Page("Tv9 Network,
Telugu").WebElement("WebElement").WaitProperty
"abs_x", page, 50000
For Desktop Application: Window("Flight
Reservation").WinObject("Insert Done").WaitProperty
"text", text,30000
NOTE: There is a mistake done by beginners is to
apply and try to find synchronization point after stopping the recording.
You can enter Exist and/or Wait statements to
instruct QuickTest to wait for a window to open or an object to appear. Exist
statements return a boolean value indicating whether or not an object currently
exists. Wait statements instruct QuickTest to wait a specified amount of time
before proceeding to the next step. You can combine these statements within a
loop to instruct QuickTest to wait until the object exists before continuing
with the test.
For example, the following statements instruct
QuickTest to wait up to 20 seconds for the Flights Table dialog box to open.
x=Window("Flight
Reservation").Dialog("Flights Table").Exist
counter=1
While Not x
Wait (2)
x=Window("Flight
Reservation").Dialog("Flights Table").Exist
Counter=counter+1
If counter=10 then
x=True
End if
Wend
No comments:
Post a Comment