|The Network Suite functionality is deprecated. We don’t recommend using it for distributed testing. Consider using a CI/CD system for managing distributed tests. See Migrating Distributed Tests to CI/CD Systems for details. In case you need to run web tests on multiple environments in parallel, you can also try using your project’s Execution Plan.|
Synchronize method tries to synchronize the test execution flow in the current project with test execution flows of other projects by a particular synchronization point (synchpoint). The current project must contain this synchpoint, otherwise the
Synchronize method will raise an exception.
Due to the
Synchronize method, test execution of the current project suspends and waits until any of the following events occur:
Other projects, which have a synchpoint with the same name, execute their tests up to the operation or script line that calls the
Synchronizemethod for the same synchpoint (this line is executed as well);
The specified time limit is reached.
If at least one of the projects subscribed to the synchpoint does not synchronize within the specified period, synchronization will not be reached.
|Timeout||[in]||Optional||Integer||Default value: 0|
The method is applied to the following object:
The method has the following parameters:
Specifies the name of the desired synchpoint (case-insensitive).
Sets the time limit in milliseconds. 0 (the default value) means the waiting time is infinite.
True if synchronization is reached, and False otherwise.
Regardless of the method result value (True or False), the test engine considers the project has gone through the synchronization point.
We’ll illustrate this by citing an example. Suppose you have two projects, Project A and Project B, that need to be synchronized. Suppose that in Project A you call the
Synchronizemethod with some timeout specified. Also, suppose that this method call returns False for some reason (this may happen, for example, if Project B was unable to reach the synchronization point within the expected time period).
Though the method returned False, the test engine will consider Project A has gone through the synchronization point. Now, if you call the
Synchronizemethod in Project B, this method call will return True as if both projects reached the synchronization point at the same time.
Do not call the
Synchronizemethod from event handlers. The method will not perform synchronization and will return False.
- If a slave project has a specified synchpoint, but does not call the
SynchPoint.WaitFormethod for this synchpoint, while the other projects are waiting for synchronization by that synchpoint, the synchronization will never complete. To avoid such a situation, either trace all of your projects’ synchpoints and synchronization methods, or use the Timeout parameter of the
WaitFormethod to set a synchronization timeout for your projects.
- If the execution of a slave project that has the specified synchpoint but does not call the
SynchPoint.WaitFormethod for this synchpoint is finished before the synchronization timeout specified for other projects elapses, the synchronization is considered successful and the
Synchronizemethod returns True.
For more information on using the
Synchronize method and for sample code, see Synchronization Points.