MACROMEDIA FLEX 2-TESTING FLEX APPLICATIONS WITH MERCURY QUICKTEST PROFESSIONAL Applications - page 9
Test creation overview
9
Operations are actions that you perform on objects. They are equivalent to a Flex event, but
are generally at a higher level. For example, when you click on a Button, QTP records a “click”
operation. QTP does not record the mouseDown and mouseUp events, which essentially
make up the click event.
Each operation has one or more arguments that define information about the event. This
information includes details such as what keys were held down when the operation occurred
or the index of a selected item in a list.
Not all controls have operations. For example, the FlexRule controls do not have operations.
You can still add these controls to the object repository and use checkpoints to test object
properties. Other controls without operations, such as FlexRepeater and FlexDisplayObject,
are low-level objects that you generally do not have to interact with for your tests.
Automated testing requires that each component be identifiable by a set of persistent
unchanging properties, with one main one, automationName, which is human readable and
easily associated with its on-screen counterpart. Collectively, this set of properties is called the
automation ID. QTP stores the automation ID in a repository. A change to a component’s ID
results in multiple versions of the object in the repository. Additionally, QA engineers can
create data driven scripts by changing these IDs with IDs from a database.
QTP specifically avoids treating list items as components, because the identifiers for list items
can change in an editable list, and identifiers can repeat (for example, a data grid with rows
that have repeating text). Also, creating and or requiring entries in the repository for list items
can create a huge burden for data driven scripts, because you must put all of your list items in
the repository and change many objects in the repository.
Storing objects
With QTP, you can record and play back your interaction with the Flex application or you
can write the script yourself. It is generally easier to have QTP record your actions with a Flex
application, and then modify that recorded script. During a recording session, QTP adds the
Flex objects that you interact with to the object repository. Otherwise, you would have to
define each object separately before using it in your own script.
When QTP encounters a Flex control during a test, it stores a set of properties that describe
that object and stores a reference to it in the object repository. The definition of the Flex
control in the QTP object repository contains enough information for QTP to map that Flex
control (such as, Button) to a test object (such as, FlexButton).