Testing Rich internet applications developed in Flex / Adobe Flash using Quick Test pro – using checkpoints.
Checkpoints let you examine objects and fail or pass the test based on whether the object contains the value you expected. During the test, QTP compares the current value against the expected value in the checkpoint. If the values do not match, then the test fails. If they do match, the test passes.
The Flex QTP plugin supports the following checkpoint types:
■ Table The Flex QTP plugin does not support the following checkpoints:
Standard checkpoints let you examine the properties of controls. You can examine any Flex object in the object repository. The testable properties include both information about the objects state (such as a TextAreas text property) and information about the objects appearance (such as the bgcolor style property or the height and width properties).
The available properties are a subset of the Flex controls full property set, but they include most commonly used properties. For a complete list of properties, see the tea.html document.
The following example shows part of a script that uses the Check method, which verifies whether the actual value of an item matches the expected value:
For more information, see the QuickTest Professional Object Model Reference.
When using Bitmap Checkpoints, ensure that you account for differences in the appearance of Flex objects. These differences can be due to tab focus on a test object or to the objects reaction to a mouseOver event. If you add a bitmap checkpoint on a region of the application that has an object with focus (and has the halo effect around that object), you must ensure that your object has focus during the test.
The following example shows the differences among a FlexButton test object with no focus, a FlexButton with focus, and a FlexButton with the mouse over it:
FlexImage objects never visibly have focus, so this is not a concern if you use a Bitmap Checkpoint for checking images.
Table checkpoints let you examine properties in List-based controls and containers. You can use table checkpoints with all of the Flex List-based controls, which include the List, DataGrid, TileList, and Tree controls. You can also use table checkpoints with all containers, which generate a list of automationValues for all of the children they contain.
Using common methods and properties
Flex test objects support the methods and properties that are common to all QTP test objects.
The following methods are the common ones:
The following properties are the common ones:
You can use the common methods and properties in the Keyword or Expert views. The following example uses the CheckProperty() method to check whether the visible property of the myList control is set to false in Expert View:
CheckProperty "visible", false For information about each of these methods and properties, see the QuickTest Professional Object Model Reference.
To play back a test, you do not need to have the browser open. QTP starts the browser for you. You must have a generated HTML wrapper that you request from QTP. You should not request the applications SWF file directly.
In some cases, the playback may not work as expected. This is most often due to synchronization. For example, an effect may take longer to play back than QTP expects, which means that while the effect is playing, QTP may be trying to move to the next step in the script. Another problem might be if you use asynchronous methods of acquiring data, such as a web service call. The script continues even if you have not yet received data from an
web service operation.
Solutions to these problems include putting in waits or checking if an object exists before continuing.