You are on page 1of 8

CS-6306 UNIFIED FUNCTIONAL TESTING Page|1

Creating Basic Test

Module 006 – Adding Synchronization

“Quality is never an accident; it is always the result of intelligent


effort.”
– John Ruskin

Overview of the Course


At the end of this module, you should be able to:
 Create basic scripts from a manual test case

 Enhance basic tests with synchronization and verification


 Parameterize tests to run with multiple sets of data

 Create and reuse modular actions


 Use the Object Repository
 Use debugging tools

 Write custom checkpoints to create more precise


verification points within a test
 Use the Object Repository Manager

 Resolve object recognition problems

Researching beyond the coverage of this module is highly encouraged


to supplement your understanding of the topics covered. Always, think
and see beyond the box.

The citation provided is a guideline. Please check each citation for


accuracy before use.
CS-6306 UNIFIED FUNCTIONAL TESTING Page|2
Creating Basic Test
So, what are we waiting for? Let us now explore the Unified Functional
Testing 12.0

Module Objectives:

After completing this module, you should be able to:

 Define synchronization in UFT for GUI Testing

 Identify the uses of synchronization in UFT for GUI


Testing

 Add a synchronization step for a specified object

GUI Testing Workflow


Synchronizing Application Events
You will now add a synchronization point to enhance the test.

UFT for GUI Testing Professional has a default global object


synchronization timeout. During test execution, UFT for GUI
Testing waits for an object to achieve a specific state, or for the
timeout of the object synchronization to be reached, before
attempting the next step.

If a process takes longer to complete then the global synchronization


timeout, the next step might fail. To give these longer steps in a test
enough time to complete, add a synchronization point.

Synchronization
If you do not want UFT for GUI Testing to perform a step or
checkpoint until an object in your application achieves a certain
status, you should insert a synchronization point to instruct UFT for
GUI Testing to pause the test until the object property achieves the
value you specify (or until a specified timeout is exceeded).

For example, suppose you record a test on a flight reservation


application. You insert an order, and then you want to modify the
order. When you click the Insert Order button, a progress bar is
displayed and all other buttons are disabled until the progress bar
reaches 100%. When the progress bar reaches 100%, you record a
click on the Update Order button.

Without a synchronization point, the UFT for GUI Testing tool


may try to click the Update Order button too soon during a test run (if
the progress bar takes longer than the test's object synchronization
timeout), and the test fails.
CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|2
You can insert a synchronization point that instructs the UFT
for GUI Testing tool to wait until the Update Order button is enabled.

GUI Testing Workflow


Synchronizing Application Events

You will now add a synchronization point to enhance the test.

UFT for GUI Testing Professional has a default global object


synchronization timeout. During test execution, UFT for GUI
Testing waits for an object to achieve a specific state, or for the
timeout of the object synchronization to be reached, before
attempting the next step.

If a process takes longer to complete then the global


synchronization timeout, the next step might fail. To give these
longer steps in a test enough time to complete, add a
synchronization point.

Synchronization
If you do not want UFT for GUI Testing to perform a step or
checkpoint until an object in your application achieves a certain
status, you should insert a synchronization point to instruct UFT for
GUI Testing to pause the test until the object property achieves the
value you specify (or until a specified timeout is exceeded).

For example, suppose you record a test on a flight reservation


application. You insert an order, and then you want to modify the
order. When you click the Insert Order button, a progress bar is
displayed and all other buttons are disabled until the progress bar
reaches 100%. When the progress bar reaches 100%, you record a
click on the Update Order button.

Without a synchronization point, the UFT for GUI Testing tool


may try to click the Update Order button too soon during a test run (if
the progress bar takes longer than the test's object synchronization
timeout), and the test fails.

You can insert a synchronization point that instructs the UFT


for GUI Testing tool to wait until the Update Order button is enabled.

Understanding Synchronization
Synchronization is used to instruct UFT for GUI Testing to wait for the
application process to complete before proceeding to the next
step in the test.

For example, users can see when the application has completed
its processing and is ready to proceed. The UFT for GUI Testing
CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|3
tool uses synchronization to simulate this behavior before
moving on to the next step in the test.

Several options are available for synchronizing your test:

You can insert a synchronization point, which instructs the UFT for
GUI Testing tool to pause the test until an object property achieves the
value you specify. When you insert a synchronization point into your
action, a Wait Property statement is added to the action.

You can insert Exist or Wait statements that instruct the UFT for GUI
Testing tool to wait until an object exists or to wait a specified amount
of time before continuing the test.

You can modify the default amount of time that the UFT for GUI
Testing tool waits for a Web page to load.

When working with tests, you can increase the default timeout
settings for a test to instruct UFT for GUI Testing to allow more time
for objects to appear.

Inserting a Synchronization Point


You can insert a synchronization point that instructs the tool
to wait until the Update Order button's enabled property equals 1.
The Synchronization point dialog box has following elements:
o Class – The test object class of the selected object.

o Test object name – The name of the selected object.

o Property name – The list of the identification properties


associated with the object class. Select the property you want to
use for the synchronization point.

o Property value – Enables you to specify the property value for


which UFT for GUI Testing should wait before continuing to the
next step in the test. The property values that the object has at
the time that you insert the synchronization point do not impact
the specified synchronization point.

o Timeout (in milliseconds) – The time (in milliseconds) that you


want UFT for GUI Testing to wait before continuing to the next
step, if the specified property value was not achieved.

Examine Ways to Synchronize


Timeout Value Modification
CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|4

If you find that, in general, the amount of time UFT for GUI Testing
waits for objects to appear or for a browser to navigate to a specified
page is insufficient, you can increase the default object
synchronization timeout values and the browser navigation timeout
values for your test.
Alternatively, if you insert synchronization points and Exist and/or
Wait statements for the specific areas in your test where you want
UFT for GUI Testing to wait a longer time for an event to occur, you
might want to decrease the default timeouts for the rest of your test.

Inserting an Exist/Wait Statement


You can enter Exist and/or Wait statements to instruct UFT for GUI
Testing to wait for a window to open or an object to appear. Exist
statements return a Boolean value indicating whether or not an
object currently exists. Wait statements instruct UFT for GUI
Testing to wait a specified amount of time before proceeding to the
next step. You can combine these statements within a loop to
instruct UFT for GUI Testing to wait until the object exists before
continuing with the test.
For example, the following statements instruct UFT for GUI Testing to
wait up to 20 seconds for the Flights Table dialog box to open.

blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist


counter=1 While Not blnDone Wait (2)

blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist

counter=counter+1 If counter=10 then

blnDone=True End if Wend

Object Synchronization
When you add a synchronization point in a test, you specify a
Timeout value for the synchronization point. This timeout value is
known as a synchronization step timeout value. The synchronization
step timeout value is added to the global timeout value.

UFT for GUI Testing waits up to the total allotted time to


recognize the object. For example, consider an object that has a
global timeout of 10 seconds and a synchronized timeout of 10
seconds. If the actual time that UFT for GUI Testing takes to recognize
the object is 20 seconds, the test moves to the next step after 20
seconds.

The Test Settings dialog box enables you to choose what to do


CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|5
when an error occurs during the run session, set the object
synchronization timeout, and choose whether or not to disable the
Smart Identification mechanism for the test.

To access, the Test Settings dialog box, with a test or an action in


focus, select File ␣
Settings ␣Run.

This pane applies to the entire test. You can set the run
properties for an individual action in a test from the Run tab in the
Action Call Properties dialog box of a selected action.

By default, when you run a test with global data table


parameters, UFT for GUI Testing runs the test for each row in the
Data pane using the parameters you specified.

You can use this pane to instruct UFT for GUI Testing to run
iterations on a test only for certain lines in the Global tab in the Data
pane.

User interface elements are described below:


 Data Table iterations – Specifies the iterations for the test. Select an
option:

 Run one iteration only – Runs the test only one time, using only the
first row in the global data table.

 Run on all rows – Runs the test with iterations using all rows in the
global data table. ␣
 Run from row to row – Runs the test with iterations using the
values in the global

 data table for the specified row range.

 When error occurs during run session – Specifies how UFT for GUI
Testing responds to an error during the run session.

 Object synchronization timeout – Sets the maximum time (in


seconds) that UFT for GUI Testing waits for an object to load before
running a step in the test.

 Note: When working with Web objects, UFT for GUI Testing waits
up to the amount of time set for the Browser navigation timeout
option, plus the time set for the object synchronization timeout.

 Disable Smart Identification during the run session – Instructs UFT


for GUI Testing not to use the Smart Identification mechanism during
the run session.

 Note: When you select this option, the Enable Smart Identification
check boxes in the Object Properties and Object Repository windows
are disabled, although the settings are saved. When you clear this
option, the Enable Smart Identification check boxes return to their
previous on or off setting.
CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|6
 Save image of desktop when error occurs (if test is run by the HP
Business Process Monitor) – This option is applicable only to tests
that are run by the Business Process Monitor component of HP
Business Availability Center.

 Selecting this option


instructs UFT for GUI Testing to capture a snapshot of the desktop if
an error occurs during a run session of a test initiated by the
Business Process Monitor. The image is saved in Business Availability
Center. The Business
Process Monitor forwards the run results to the Business Availability
Center servers.
CS-6306 UNIFIED FUNCTIONAL TESTING
Adding Synchronization Page|7

References and Supplementary Materials


Books and Journals

Micro. Customized Unified Functional Testing 12.0 Essentials


Student Guide
Hewlett-Packard Development Company, L.P.
http://hp.com/software/education

You might also like