What is synchronization and why it is important?

Synchronization, in the context of .NET, is a process that involves coordinating the execution of multiple threads to ensure the desired outcome without corrupting the shared data and preventing any occurrence of deadlocks and race conditions.

Synchronization also occurs between network nodes to ensure that data streams are received and transmitted correctly, and to prevent data collision. It usually uses a clock signal transmitted in sequence with a data stream to maintain proper signal timing.
 
It is a process of matching the speeds of both QTP and AUT in order to get proper execution and results.

Where Synchronization is required:
During test execution QTP gives instructions one by one with same speed, but AUT takes less time for some operations execution and more time for some operations execution, that time we may not get proper execution and results. In order to get proper results in between QTP & AUT synchronization is required.
There are several methods available in QTP for synchronization.
1. Inserting Wait statements.
2. Inserting Synchronization points.
3. Increasing Tool default synchronization time.
4. Sync Method (Only for WEB)
5. Exist Property
 
Some resources in programming (such as files, data structures, etc) don't handle being accessed at the same time very well.

For example, two threads adding an object to a list at the same time could end up working correctly, dropping one or both of the items, or completely corrupting the state of the list.

In that example, synchronization would be making sure that only one thread is accessing the list at a time, which should prevent any problems from arising.

Most languages provide facilities for synchronization. In Java, for example, there are synchronized blocks and methods and the Lock interface and its implementations.

Thanks
Emily
 
Back
Top