NetworkSuite.Synchronize Method

Applies to TestComplete 14.20, last modified on September 11, 2019

Description

The 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 Synchronize method 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.

Declaration

NetworkSuite.Synchronize(SynchpointNameTimeout)

SynchpointName [in]    Required    String    
Timeout [in]    Optional    Integer Default value: 0   
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

SynchpointName

Specifies the name of the desired synchpoint (case-insensitive).

Timeout

Sets the time limit in milliseconds. 0 (the default value) means the waiting time is infinite.

Result Value

True if synchronization is reached, and False otherwise.

Remarks

  • 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 Synchronize method 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 Synchronize method 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 Synchronize method 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 NetworkSuite.Synchronize or SynchPoint.WaitFor method 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 Synchronize or WaitFor method 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 NetworkSuite.Synchronize or SynchPoint.WaitFor method for this synchpoint is finished before the synchronization timeout specified for other projects elapses, the synchronization is considered successful and the Synchronize method returns True.

For more information on using the Synchronize method and for sample code, see Synchronization Points.

See Also

Distributed Testing
Synchronization Points
Synchronizing Projects in Network Suites

Highlight search results