How Does Silk Test Workbench Synchronize Tests?

Many unexpected test failures are related to synchronization issues. Weak synchronization during test replay might generate false negative results, making it difficult to detect actual application problems. Synchronization errors are timing issues that heavily depend on the test environment, making these errors difficult to reproduce and solve. For example, a synchronization error that occurs in a specific test environment might never be reproduced in the development environment. Weak synchronization is one of the most common reasons for an automation project to get unmanageable with a growing set of automated tests.

Silk Test Workbench provides automated test synchronization for all supported technologies, enabling you to build robust and manageable test sets. During the replay of a test, Silk Test Workbench ensures that the test always waits until the AUT is ready to perform the next action. For a verification step in a test, Silk Test Workbench ensures that any preceding actions in the test are completed before performing the verification.

To adapt your tests to the specific behavior of your AUT, you can change the values of the following synchronization timeouts:
Synchronization timeout (OPT_SYNC_TIMEOUT)
The maximum time in milliseconds that Silk Test Workbench waits for the AUT to become ready during playback. The default value is 300000 milliseconds.
Object resolve timeout (OBJ_WAIT_RESOLVE_OBJDEF)
The maximum time in milliseconds that the Find method searches for an object. The default value is 5000 milliseconds.
Note: To be able to successfully run tests under load or on slow systems, for example a virtual machine accessed through a slow connection, Silk Test Workbench occasionally increases the internal timeout, for example while the AUT is starting and when a dialog or window appears. As soon as the AUT, dialog, or window is completely started, Silk Test Workbench reduces the timeout again to the value you have specified for OPT_WAIT_RESOLVE_OBJDEF.
Object resolve retry interval (OPT_WAIT_RESOLVE_OBJDEF_RETRY)
If Silk Test Workbench cannot immediately find an object, Silk Test Workbench will retry to find the object until the object resolve timeout expires. The object resolve retry interval specifies the time in milliseconds that Silk Test Workbench waits before retrying to find the object. The default value is 1000 milliseconds.
Object enabled timeout (OPT_OBJECT_ENABLED_TIMEOUT)
The maximum time in milliseconds that Silk Test Workbench waits for an object to become enabled during playback. The default value is 1000 milliseconds.
Note: The timeouts do not overlap.

For detailed information about the automated synchronization that Silk Test Workbench provides specifically for Web applications, see Page Synchronization for xBrowser. For detailed information about the synchronization that Silk Test Workbench provides specifically for Ajax applications, see How to Synchronize Test Automation Scripts for Ajax Applications.

In addition to the automated synchronization, Silk Test Workbench also enables you to manually add wait functions to your VB . NET scripts. Silk Test Workbench provides the following wait functions for manual synchronization:
WaitForObject
Waits for an object that matches the specified locator. Works with an xPath locator or an object map identifier.
WaitForProperty
Waits until the specified property gets the specified value or until the timeout is reached.
WaitForPropertyNotEquals
Waits until the value of the specified property no longer equals the specified value or until the timeout is reached.
WaitForDisappearance
Waits until the object does not exist or until the timeout is reached.
WaitForChildDisappearance
Waits until the child object specified by the locator parameter does not exist or until the timeout is reached.
WaitForScreenshotStable
Waits until the object is visually stable and does not change its position.

If a test randomly fails with an ObjectNotFoundException, increase the Object resolve timeout, for example to 30 seconds. For very specific long running operations, for example a click on an object that displays after a long calculation with a progress dialog, manually add the WaitForObject method to the test script, to wait until the object is found, or add the WaitForDisappearance method to the test script, to wait until the progress dialog is no longer displayed.

Automated synchronization example

Consider the following code sample, where Silk Test Workbench tries to click on a button with the caption Ok:

'VB .NET code
Dim button = _desktop.PushButton("@caption='Ok'")
button.Click()
To replay the actions in this code sample, Silk Test Workbench performs the following synchronization actions:
  1. Silk Test Workbench tries to find the button. If the Object resolve timeout runs out, Silk Test Workbench stops the replay and throws an exception.
  2. Silk Test Workbench waits until the application under test (AUT) is ready. If the Synchronization timeout runs out before the AUT is ready, Silk Test Workbench stops the replay and throws an exception.
  3. Silk Test Workbench waits until the button is enabled. If the Object enabled timeout runs out before the button is enabled, Silk Test Workbench stops the replay and throws an exception.
  4. Silk Test Workbench clicks the button.
  5. Silk Test Workbench waits until the application under test (AUT) is ready again.