This functionality is supported only if you are using the Open Agent.
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 Classic 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 Classic 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 Classic 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 seconds that
Silk Test Classic waits for the AUT to become ready during playback. The default value is 300 seconds.
- Window timeout (OPT_WINDOW_TIMEOUT)
- The maximum time in seconds that the
Find method searches for a window. The default value is 5 seconds.
- Window retry interval (OPT_WINDOW_RETRY)
- If
Silk Test Classic cannot immediately find a window,
Silk Test Classic will retry to find the window until the window timeout expires. The window retry interval specifies the time in seconds that
Silk Test Classic waits before retrying to find the window. The default value is 0.5 seconds.
- Timeout to wait for an enabled window (OPT_OBJECT_ENABLED_TIMEOUT)
- The maximum time in seconds that
Silk Test Classic waits for a window to become enabled during playback. The default value is 1 second.
Note: The timeouts do not overlap.
For detailed information about the automated synchronization that
Silk Test Classic provides specifically for Web applications, see
Page Synchronization for xBrowser. For detailed information about the synchronization that
Silk Test Classic provides specifically for Ajax applications, see
How to Synchronize Test Automation Scripts for Ajax Applications.
In addition to the automated synchronization,
Silk Test Classic also enables you to manually add wait functions to your scripts.
Silk Test Classic 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 property specified by the
propertyName parameter gets the value specified by the
expectedValue parameter 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.
If a test randomly fails with an
ObjectNotFoundException, increase the
Window 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 Classic tries to click on a button with the caption
Ok:
WINDOW button = Desktop.Find("//PushButton[@caption='ok'")
button.Click()
To replay the actions in this code sample,
Silk Test Classic performs the following synchronization actions:
- Silk Test Classic tries to find the button. If the
Window timeout runs out,
Silk Test Classic stops the replay and throws an exception.
-
Silk Test Classic waits until the application under test (AUT) is ready. If the
Synchronization timeout runs out before the AUT is ready,
Silk Test Classic stops the replay and throws an exception.
- Silk Test Classic waits until the button is enabled. If the
Timeout to wait for an enabled window runs out before the button is enabled,
Silk Test Classic stops the replay and throws an exception.
- Silk Test Classic clicks the button.
-
Silk Test Classic waits until the application under test (AUT) is ready again.