Documente Academic
Documente Profesional
Documente Cultură
Objectives
After completing this chapter, you will be able to: Define synchronization. Examine when and where synchronization is most helpful. Add a synchronization step for a specified object.
Prepare
Setup for test automation Document manual test steps Check applications/ environment stability Check that data is valid
Create
Integrate
Create basic test Record user actions Confirm successful playback Use Object Repository
Integrate tests
Insert checkpoints
Data drive the test
So far we have created a basic test. We should enhance the test by adding a synchronization point.
What is Synchronization?
What is Synchronization?
Synchronization is a step added to a test that instructs QuickTest to wait for the state of a property on a particular object to change before proceeding to the next step in the test. Just like a manual tester will wait for a visual cue to know when the AUT has completed its processing, we instruct QTP to wait for a cue prior to moving on to the next step in the test. A synchronization point allows the test to pause while an application process completes, before moving on to the next step.
QTP has a global object synchronization timeout. When a step attempts to interact with an object that is not available when the application is still processing, QTP will wait for either the object to become available or for the object synchronization timeout to occur. If one process takes considerably longer than others, the global synchronization timeout may not be long enough for the process to complete. And in this case, the next step might fail. To give these longer processes enough time to complete, we add a synchronization point to extend the time QTP will wait before moving on to the next step.
Wait times often occur before an object becomes available for the next step. For example, in the Flights application, once the Insert Order button has been clicked, a progress bar must complete before the reservation Order No. will be displayed. The progress bar may require additional time before the test can proceed. If insufficient time is allocated for these special circumstances, the test may fail.
The error message, Object not enabled appears if QuickTest is running a test and proceeds to the next step before the previous step has fully processed. QTP will wait only as long as it takes for the process to complete, not necessarily the full timeout.
Synchronization points instruct QuickTest to pause until an object property achieves a specified value. The easiest way to add a synchronization point is while recording. Always add the synchronization point immediately after the step to be synchronized. From the QTP menu bar, choose INSERT STEPSYNCHRONIZATION POINT. Step timeout values add to the global values.
Object Synchronization
Test run 1 Test run 2
OK
Error
Script Continues
Global Timeout
Object Synchronization
When the synchronization timeout is set for a step, this value is added to the global timeout value. QTP has a default timeout between test steps of 20000 milliseconds (20 seconds). May not wait for the full timeout to arrive.
Object Synchronization
For example: Lets say an object has a global timeout of 30 seconds and a synchronized timeout of 30 seconds. If the actual time it takes for QTP to recognize the object is 40 seconds, the test will move to the next step after 40 seconds. This feature applies to environments that do not synchronize automatically. Examples of auto-synchronizing environments: - Web; SAP; TE
Review Questions
1.
2.
3.
4.
How long will QTP wait if: - synchronization timeout is set to 10 seconds and the global timeout is set to 40 seconds, but the actual time for the object to be recognized is 25 seconds:
10 b) 40 c) 50 d) None of the above
a)