Description
The SynchPoint
object allows you to get access to the specified synchronization point defined in the current project from your tests.
The SynchPoint
object is returned by the SynchPoint_Item
property of the SynchPoints
object. Note that instead of the SynchPoint_Item string, you must enter the name of the needed synchronization point. For example, to obtain the object corresponding to the SynchPoint1 synchpoint defined in your project, you can use the following code:
JavaScript, JScript
Python
MySynchPoint = NetworkSuite.SynchPoints.SynchPoint1
VBScript
DelphiScript
C++Script, C#Script
Members
Example
The following example demonstrates how you can access the synchpoint collection from script and synchronize tests execution by using the desired synchpoint from this collection. The example uses the SynchPoint.WaitFor
method to simultaneously start creating new files on different computers. Remember that this code must be added to all the projects that will create files.
JavaScript, JScript
// Obtain the collection of synchronization points defined in the current project
MySynchPointCollection = NetworkSuite.SynchPoints;
// Obtain the synchpoint named Synchpoint1 from the collection
MySynchPoint = MySynchPointCollection.Synchpoint1;
// Synchronize the script execution flow of the current project with script execution flows of other projects
MySynchPoint.WaitFor();
// Call the routine that creates files
CreateFiles(0);
...
Python
# ...
# Obtain the collection of synchronization points defined in the current project
MySynchPointCollection = NetworkSuite.SynchPoints
# Obtain the synchpoint named Synchpoint1 from the collection
MySynchPoint = MySynchPointCollection.Synchpoint1
# Synchronize the script execution flow of the current project with script execution flows of other projects
MySynchPoint.WaitFor()
# Call the routine that creates files
CreateFiles(0)
VBScript
' Obtain the collection of synchronization points defined in the current project
Set MySynchPointCollection = NetworkSuite.SynchPoints
' Obtain the synchpoint named Synchpoint1 from the collection
Set MySynchPoint = MySynchPointCollection.Synchpoint1
' Synchronize the script execution flow of the current project with script execution flows of other projects
Call MySynchPoint.WaitFor
' Call the routine that creates files
Call CreateFiles(0)
...
DelphiScript
// Obtain the collection of synchronization points defined in the current project
MySynchPointCollection := NetworkSuite.SynchPoints;
// Obtain the synchpoint named Synchpoint1 from the collection
MySynchPoint := MySynchPointCollection.Synchpoint1;
// Synchronize the script execution flow of the current project with script execution flows of other projects
MySynchPoint.WaitFor;
// Call the routine that creates files
CreateFiles(0);
...
C++Script, C#Script
// Obtain the collection of synchronization points defined in the current project
MySynchPointCollection = NetworkSuite["SynchPoints"];
// Obtain the synchpoint named Synchpoint1 from the collection
MySynchPoint = MySynchPointCollection["Synchpoint1"];
// Synchronize the script execution flow of the current project with script execution flows of other projects
MySynchPoint["WaitFor"]();
// Call the routine that creates files
CreateFiles(0);
...
See Also
NetworkSuite.SynchPoints Property
Distributed Testing
Synchronization Points