QTP Checkpoints for Adobe Flash / Flex

Posted on Feb 2 2008 - 1:44am by Raj

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:
■ Bitmap
■ Standard
■ Table The Flex QTP plugin does not support the following checkpoints:
■ Accessibility
■ Database
■ Image
■ Page
■ Text
Standard 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 object’s state (such as a TextArea’s text property) and information about the object’s appearance (such as the bgcolor style property or the height and width properties).
The available properties are a subset of the Flex control’s 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:
FlexForm("index:4").Check CheckPoint("index:4")
For more information, see the QuickTest Professional Object Model Reference.

Bitmap checkpoints
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 object’s 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
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:
■ CaptureBitmap
■ Check
■ CheckProperty
■ ChildObjects
■ GetROProperty
■ GetTOProperty
The following properties are the common ones:
■ Exist
■ Object

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:
Browser("My Page").FlexApplication("MyApp").FlexCheckBox("myList").
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 application’s 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.

About the Author

Leave A Response