11 Using the Adobe Flex Functional Test Module

This chapter provides instructions on configuring and using the OpenScript Adobe Flex Functional Test Module, which provides support for functional testing of Adobe Flex-based web applications.

11.1 About the Adobe Flex Functional Test Module

The OpenScript Adobe Flex Functional Test Module provides support for functional testing of web applications that use the Adobe Flex Automation Framework. The OpenScript Adobe Flex Functional Test Module provides the ability to record, playback and validate transactions inside Adobe Flex applications embedded in web pages. The OpenScript Adobe Flex Functional Test Module is an extension to the Web Functional Test Module.

The Adobe Flex Functional Test Module is an extension module to the OpenScript Web Functional Test Module that extends the Web testing with Adobe Flex Functional Test recording and playback capabilities. The Adobe Flex Functional Test Module is fully integrated with the OpenScript platform including the Results view, Details view, Properties view, Console/Problems views, Preferences, Step Groups, Script Manager, and Workspace Manager.

The Adobe Flex Functional Test recorder displays commands in the Tree View in easy-to-understand commands. Script commands correspond to Adobe Flex events generated by the Adobe Flex Automation Framework as OpenScript actions. By default, script commands are recorded sequentially. Step groups can be added manually but are not created by default.

OpenScript shows the results of Adobe Flex Functional Test script playback in the Results view. The Results view shows results for each script command (including duration and summary for failures). The Results Report compiles the same information into an HTML Results Report. Results can be exported from the OpenScript GUI in standard format (CSV / HTML). Results are also generated for unattended playback through the command line.

The Adobe Flex Functional Test Module API includes a "flexFT" class that provides additional programming functionality.

11.1.1 Key Features of the Adobe Flex Functional Test Module

  • The OpenScript Adobe Flex Functional Test Module is based on the Adobe Flex Automation Framework. The Flex Automation Framework (the framework) provides the following features:

    • A wide range of reliable record and playback functionality across the broad suite of built-in Flex controls.

    • Documented and supported means of extending the record and playback functionality to custom controls.

    • Standardized object identification.

    • Product behavior consistent with Adobe's documentation about how to test Flex applications.

  • Records Adobe Flex actions for automation and validation of Flex applications of any version (2, 3, 4) using any browser (IE or FF). Supports Flash application created with Flex framework.

  • Plays back recorded Adobe Flex actions/commands which consist of a Flex control and event plus the object identified by its attributes (for example: flexFT.textarea(138, "Path").input("LOREM IPSUM");).

  • Provides full script code view integration to support script generation for the OpenScript Adobe Flex Functional Test Module. The OpenScript Adobe Flex Functional Test Module includes an additional API to support Flex Functional Test protocol code scripting.

  • Allows users to parameterize user inputs to OpenScript Adobe Flex Functional Test scripts and drive those inputs from an external data file (Databank).

  • Allows users to insert Tests to validate Adobe Flex content on playback.

  • Reports playback results for OpenScript Adobe Flex Functional Test scripts in the Results and Console views.

  • The OpenScript Adobe Flex Functional Test Script Module API. The OpenScript Adobe Flex Functional Test Application Programming Interface include Java code methods specific to functional testing of Adobe Flex applications. The API provides support for the MX component classes available in Flex 3.

The New Project wizard (Select New from the File menu) includes an "Adobe Flex " option to use when creating Flex functional testing projects in OpenScript. OpenScript captures user actions and records them to the OpenScript script nodes in a highly readable sequence of navigations and actions.

11.1.2 Prerequisites

The Adobe Flex Functional Test Module recorder has the following prerequisites:

Note:

The automation libraries/swc files are required for Flex Functional Testing only. This does not apply for Adobe Flex (AMF) load testing which records at the protocol level.
  • The Flex application must include the Adobe Flex automation libraries either at compiles time or at run time. You need at least automation.swc and automation_agent.swc from the Adobe <flex builder>\sdks\3.5.0\frameworks\libs folder (3.5.0 is an Adobe sdk version). Also, automation_dmv.swc is required for charts, advanceddatagrid and olapdatagrid support. See the Creating Applications for Testing section of the Adobe Flex Data Visualization Developer's Guide for additional information about the tasks required to include the Flex automation libraries.

    Creating Applications for Testing:

    http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_15.html#178953

    Adobe Flex Data Visualization Developer's Guide:

    http://livedocs.adobe.com/flex/3/html/help.html?content=functest_components2_15.html#178953

  • The Oracle OpenScript openscript_agent.swc file must be included when re-compiling Flex applications. The Flex application must be linked with the OpenScript Flex agent located in <installdir>\OpenScript\plugins\oracle.oats.scripting.modules.flexFT_version\flexagent\openscript_agent.swc or equivalent.

11.2 Recording Adobe Flex Functional Tests

The Adobe Flex Functional Test Module records web applications that use the Adobe Flex Automation Framework. The Recorder creates functional and regression test scripts for automating testing of Adobe Flex applications.

Events are recorded as they are generated by the Adobe Flex Automation Framework and played back through the framework.

The Adobe Flex Functional Test Module provides the object/attribute information for OpenScript to record interactions with those controls. Actions will be captured in the test script as OpenScript "flexFT" commands. Other components are standard Web controls which are captured as standard OpenScript "web" commands using Web Functional Test object attributes. Object Identification attributes can later be modified by users through the Preferences global settings for new scripts or for already recorded commands in the tree view or code view.

The Adobe Flex Functional Test Module provides a record toolbar button that lets you initiate the Adobe Flex recorder and capture Web/Adobe Flex events to the script view. The record toolbar includes start and stop recording toolbar buttons. OpenScript recorders also open a floating toolbar that can be used while recording without having to switch between the browser and OpenScript.

11.2.1 Recording Adobe Flex Functional Test Scripts

To record Adobe Flex Functional Test scripts:

  1. Start OpenScript.

  2. Set the Adobe Flex Functional Test Recording preferences.

  3. Select New from the File menu.

  4. Expand the Functional Testing group.

  5. Select Adobe Flex (The Adobe Flex script combines both Web and Adobe Flex technologies as part of the same script).

  6. Click Next.

  7. Select the Repository and Workspace.

  8. Enter a script name.

  9. Click Finish. A new Script tree is created in the Script View.

  10. Select Record from the Script menu. The browser automatically opens when you start recording.

  11. Load the web page where you want to start recording into the browser.

  12. Navigate the web site to record page objects, actions, and navigations. The page objects, actions, and navigations will be added to the node of the script tree specified by the Set Record Section setting (the Run node is the default).

  13. When finished navigating pages, close the browser.

  14. Select Stop from the Script menu or click the Stop button on the OpenScript toolbar.

  15. Expand the Run node of the script to view the page objects, actions, and navigation nodes in the script tree.

    You can customize the script using the menu options or the Code View for specific testing requirements.

    Note:

    Do not close the script editor view or script project while recording or playing back scripts. Doing so could result in unpredictable behavior in the OpenScript application.

11.3 Playing Back Scripts

OpenScript plays back recorded Adobe Flex actions/commands which consist of an event plus an object identified by its attributes (for example: flexFT.combobox(objectId Path).select("Visa", TriggerEvent.Mouse, KeyModifier.None);). The objectId Path are hierarchical sets of object properties used to identify a specific UI component in the flex application.

The actions used for playback will either be those that are recorded or specified manually in the Java Code view. Unattended playback is supported through Oracle Test Manager or third-party tools using OpenScript's command line interface. Adobe Flex Functional Test scripts do not play in Oracle Load Testing.

The Adobe Flex Functional Test Module provides playback and iterate toolbar buttons that allows users to start the script playback for either a single playback through the script or multiple iterations using data from a databank file. Playback results for Adobe Flex Functional scripts can be viewed in the Results and Console views.

11.3.1 Adobe Flex Object Identification

The Adobe Flex Functional Test Module uses object identification to specify attributes used to identify Adobe Flex objects. The Adobe Flex Functional Test Module uses the same predefined path attributes for common Web objects as the Web Functional Test Module; however, Adobe Flex Test Automation provides additional attributes to identify Flex controls. Object paths are specified in XPath format. For example the object identification path appears as follows in Java code commands:

flexFT.tree(8,"/web:window[@index='0' or @title='Adobe Flex 3 Component Explorer']
 /web:document[@index='0']
   /flex:application[@automationIndex='index:-1' and
     @automationName='explorer' and 
     @automationClassName='FlexApplication' and
     @className='explorer' and
     @label='' and 
     @id='explorer']
   /flex:dividedBox[@className='mx.containers.HDividedBox' and 
     @id='null' and 
     @automationIndex='index:0' and 
     @automationName='index:0' and
     @automationClassName='FlexDividedBox' and
     @label='']
   /flex:panel[@automationIndex='index:0' and 
     @automationName='Adobe%20Flex%203%20Component%20Explorer' and
     @automationClassName='FlexPanel' and 
     @className='mx.containers.Panel' and 
     @label='' and
     @id='null']
   /flex:tree[@automationIndex='index:0' and 
     @automationName='compLibTree' and
     @automationClassName='FlexTree' and
     @className='mx.controls.Tree' and
     @id='compLibTree']")
   .select("Visual Components>Button Controls>CheckBox", 
     TriggerEvent.Mouse, KeyModifier.None);

You can set the default Web object attributes in the Web Functional Test Module Record Preferences. You can also edit object attributes in recorded scripts in the tree view or the code view. The Adobe Flex object identification is provided by the Adobe Flex Automation Framework when recording a component and are not set in OpenScript Preferences.<

In addition to the predefined object identification, you can add an Object Library to the script to record paths into a library file. Object Library files may be shared and reused across other scripts. The Object Library files provide a more convenient "short name" for objects to provide for more convenient programming.

11.3.2 Playing Back Adobe Flex Functional Scripts

To play back Adobe Flex Functional scripts:

  1. Start OpenScript.

  2. Open the Adobe Flex Functional script to play back.

  3. Select Playback from the Script menu or click the toolbar button.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

11.3.3 Playing Back Adobe Flex Functional Scripts with Iterations

To play back Adobe Flex Functional scripts with iterations:

  1. Start OpenScript.

  2. Open the Adobe Flex Functional script to play back.

  3. Select Iterate from the Script menu or click the toolbar button.

  4. Set the iteration count.

  5. Select which databank file to use, if necessary.

  6. Set the starting record for the selected databank in the Databank Settings section. See Section 4.2.4, "Playing Back Scripts With Iterations" for additional information about iteration settings.

  7. Click OK.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

11.4 Modifying Scripts

Once a script has been created/recorded, you can make modifications to customize the script for your specific testing needs.

11.4.1 Adding Flex Actions

The Adobe Flex Module includes actions for Adobe Flex objects that can be added to a script.

To add Forms actions to a script:

  1. Record a Adobe Flex Functional Test script.

  2. Select the script node where you want to add the action.

  3. Select the Script menu and then select Other from the Add sub menu.

  4. Expand the Flex Action node.

  5. Expand an action node and select the action.

  6. Click OK.

  7. Enter the object identification path for the object. You can use the Capture or Select menu options to capture or select an object path.

  8. Enter any required values to use for the object action.

  9. Click OK. The action node is added to the script tree.

    In the Java Code view, a flexFT.object(objectId).action() method will be added to the script code:

    flexFT.tree(8,"/web:window[@index='0' or @title='Adobe Flex 3 Explorer']
     /web:document[@index='0']
       /flex:application[@automationIndex='index:-1' and
         @automationName='explorer' and
         @automationClassName='FlexApplication' and
         @className='explorer' and
         @label='' and
         @id='explorer']
       /flex:dividedBox[@className='mx.containers.HDividedBox' and
         @id='null' and
         @automationIndex='index:0' and 
         @automationName='index:0' and 
         @automationClassName='FlexDividedBox' and
         @label='']
       /flex:panel[@automationIndex='index:0' and 
         @automationName='Adobe%20Flex%203%20Explorer' and 
         @automationClassName='FlexPanel' and
         @className='mx.containers.Panel' and
         @label='' and 
         @id='null']
       /flex:tree[@automationIndex='index:0' and
         @automationName='compLibTree' and
         @automationClassName='FlexTree' and 
         @className='mx.controls.Tree' and 
         @id='compLibTree']")
       .select("Visual Components>Button Controls>CheckBox", 
         TriggerEvent.Mouse, KeyModifier.None);
    

    Note:

    When adding Table, Object, or other OpenScript tests on Flex controls, you should add some Think time to the script between the OpenScript test node and the Flex control being tested. The Think time should be enough time to allow the Flex control to load completely before the OpenScript test is executed. If the OpenScript test is executed before the Flex control loads, an error will occur.

    The Adobe Flex Functional Test Module can also perform actions on Adobe Flex-specific objects such as Accordion, AdvancedDataGrid, Alert, Application, AreaChart, AreaSeries, AxisRenderer, BarChart, BarSeries, Box, BubbleSeries, Button, ButtonBar, Canvas, CartesianChart, Chart, ChartLegend, ChartSeries, Checkbox, ColorPicker, ColumnChart, ColumnSeries, ComboBase, ComboBox, Container, DataGrid, DateChoser, DateField, DisplayObject, DivideBox, Form, FormItem, HLOChart, Image, Label, LineChart, LineSeries, LinkBar, List, ListBase, ListLabel, Loader, Menu, MenuBar, NavigationBar, NumericStepper, OLAPDataGrid, Panel, PieChart, PlotSeries, PopUpButton, ProgressBar, RadioButton, Repeater, Rule, ScrollBar, ScrollBase, Slider, TabNavigator, TextArea, TitleWindow, ToggleButtonBar, Tree, UIMovieClip, VideoDisplay, ViewStack.

11.4.2 Adobe Flex Action Dialog Box

The Adobe Flex Action Dialog Box lets you specify actions to perform on Flex-specific objects. The available options and settings depend upon the type of Flex object and the specific action to perform on the object. The resulting dialog box can display the following sections and fields:

Action: Shows the type of action to perform on the Flex object.

Object: Shows the type of Flex object on which to perform on the action.

Path: Specifies the object identification path used to identify the object in the application.

Value/Values: Specifies the values to use to perform an action on a Flex object. The values vary depending upon the object type and action. All index values are zero-based.

  • Action: A String that specifies the action for drag and drop operations on controls.

  • Begin Index: An Integer that specifies the beginning index of the SelectText action for ColorPicker, ComboBase, ComboBox, DateField, NumericStepper, and TextArea controls.

  • Click Target: Specifies the target of a click action. Enter "thumb" or "track" to specify either the slider track or slider thumb. This setting is used with the Change action for Slider controls.

  • Color: A String that specifies the Hexadecimal RGB (i.e. #003366) color value for change actions on ColorPicker controls.

  • Column Index: An Integer that specifies the index of the column being clicked, edited, or stretched in Grid-type controls.

  • Data Field: A String that specifies the Header data field for click actions on Grid-type controls.

  • Delta: An Integer value that specifies the change in value for mouse scroll actions.

  • Dragged Item: A String that specifies the item dragged in DragStart and DragDrop actions on controls.

  • End Index: An Integer that specifies the ending index of the SelectText action for ColorPicker, ComboBase, ComboBox, DateField, NumericStepper, and TextArea controls.

  • Header Part: A String that specifies the headerTextPart or headerIconPart for HeaderClick actions on AdvancedDataGrid and OLAPDataGrid controls.

  • Hit Set: A Double that represents chart series data point for ClickSeries, DoubleClick, or ItemRollOver actions on AreaSeries, BarSeries, BubbleSeries, ChartSeries, ColumnSeries, LineSeries, PieSeries, and PlotSeries controls.

  • Item Renderer: A String that specifies the item within Combo, Grid, Tree, and List-type controls.

  • Key Code: A String that specifies the key code to use for Type actions on controls. The Key Codes correspond to the Adobe ActionScript key codes.

  • Key Modifier: Specifies the modifier to use for keyboard trigger events. Keyboard actions can include modifiers such as Ctrl, Alt, Shift, or combinations of modifiers such as Ctrl-Alt, or Shift-Alt.

    • None: When selected, no keyboard modifier is used for keyboard trigger events.

    • Ctrl: When selected, the Ctrl key is used as the keyboard modifier for keyboard trigger events. For example, Ctrl-key.

    • CtrlShift: When selected, the Ctrl-Shift key combination is used as the keyboard modifier for keyboard trigger events. For example, Ctrl-Shift-key.

    • Alt: When selected, the Alt key is used as the keyboard modifier for keyboard trigger events. For example, Alt-key.

    • CtrlAlt: When selected, the Ctrl-Alt key combination is used as the keyboard modifier for keyboard trigger events. For example, Ctrl-Alt-key.

    • ShiftAlt: When selected, the Shift-Alt key combination is used as the keyboard modifier for keyboard trigger events. For example, Shift-Alt-key.

    • CtrlShiftAlt: When selected, the Ctrl-Shift-Alt key combination is used as the keyboard modifier for keyboard trigger events. For example, Ctrl-Shift-Alt-key.

  • Local X: Specifies the mouse coordinate X position within the control for ColumnStretch and MouseMove actions on controls.

  • Local Y: Specifies the mouse coordinate X position within the control for MouseMove actions on controls.

  • Moving Column Index: An Integer that specifies the index of the ColumGroupedADGHeader being shifted in AdvancedDataGrid and OLAPDataGrid controls.

  • New Column Index: An Integer that specifies the new index of the ColumGroupedADGHeader being shifted in AdvancedDataGrid and OLAPDataGrid controls.

  • New Index: An Integer that specifies the new index of the header being shifted in AdvancedDataGrid and OLAPDataGrid controls.

  • Old Column Index: An Integer that specifies the old index of the olumGroupedADGHeader being shifted in AdvancedDataGrid and OLAPDataGrid controls.

  • Old Index: An Integer that specifies the old index of the header being shifted in AdvancedDataGrid and OLAPDataGrid controls.

  • Position: An Integer that specifies the position number within scroll-type controls.

  • Scroll Direction: Specifies the direction to scroll an object.

    • vertical: When selected, the scroll action is vertical.

    • horizontal: When selected, the scroll action is horizontal.

  • Scroll Detail: Specifies the scroll bar detail within scroll-type controls.

    • atLeft: When selected, the scroll bar is put to the left of its scrolling range.

    • atTop: When selected, the scroll bar is put to the top of its scrolling range.

    • atRight: When selected, the scroll bar is put to the right of its scrolling range.

    • atBottom: When selected, the scroll bar is put to the bottom of its scrolling range.

    • lineLeft: When selected, the scroll bar is moved one line to the left in the scrolling range.

    • lineUp: When selected, the scroll bar is moved one line up in the scrolling range.

    • lineRight: When selected, the scroll bar is moved one line to the right in the scrolling range.

    • lineDown: When selected, the scroll bar is moved one line down in the scrolling range.

    • pageLeft: When selected, the scroll bar is moved one page to the left in the scrolling range.

    • pageUp: When selected, the scroll bar is moved one page up in the scrolling range.

    • pageRight: When selected, the scroll bar is moved one page to the right in the scrolling range.

    • pageDown: When selected, the scroll bar is moved one page down in the scrolling range.

    • thumbTrack: When selected, the scroll action is moving.

    • thumbPosition: When selected, the scroll action is stopped.

  • Related Object: Specifies a related object for container-type controls such as Accordion, ButtonBar, LinkBar, NavigationBar, NumericStepper, TabNavigator, and ToggleButtonBar.

  • Row Index: An Integer that specifies the index of the row being edited in AdvancedDataGrid and OLAPDataGrid controls.

  • Shift Key: Specifies if the Shift Key should be used with the Key code. Valid values are True and False. This setting is used with the ChangeFocus action in all control types.

  • Text: A String that specifies the text or password text use for Input or Password Input actions on TextArea controls.

  • Thumb Index: Specifies the index of the thumb on which to perform Change actions on Slider controls.

  • Trigger Event: Specifies the action to use to trigger the event on the object.

    • Mouse: When selected, a mouse action triggers the event on the object.

    • Keyboard: When selected, a keyboard action triggers the event on the object. Specify the Key Modifier to use with the keyboard event trigger.

  • Value: A Double that specifies the value to use for Change actions on Slider controls.

11.4.3 Using the Adobe Flex Functional Test Module API

The Adobe Flex Functional Test Module includes a script Application Programming Interface (API) specific to Adobe Flex functional testing. The Adobe Flex Functional Test Module recorder creates the Java code that corresponds to the Tree View and displays the Adobe Flex Functional Test commands in the Java Code view using easy-to-understand function names. The Java Code view commands correspond to the Tree View and you can edit your scripts in either view.

You can use the Adobe Flex Functional Test API to enhance recorded scripts with additional testing functionality. Commands that are specific to the Adobe Flex Functional Testing Module are part of the "flexFT" class. Additional functional test methods are available in the "web" and "ft" classes. You can also leverage other commands from other enabled classes (services) or general Java commands in your scripts.

Some examples of the Adobe Flex Testing Module API include:

  • Accordion

  • AdvancedDataGrid

  • Alert

  • Application

  • AreaChart

  • AreaSeries

  • AxisRenderer

  • BarChart

  • BarSeries Box

  • BubbleSeries

  • Button

  • ButtonBar

  • Canvas

  • CartesianChart

  • Chart

  • ChartLegend

  • ChartSeries

  • Checkbox

  • ColorPicker

  • ColumnChart

  • ColumnSeries

  • ComboBase

  • ComboBox

  • Container

  • DataGrid

  • DateChoser

  • DateField

  • DisplayObject

  • DivideBox

  • Form

  • FormItem

  • HLOChart

  • Image

  • Label

  • LineChart

  • LineSeries

  • LinkBar

  • List

  • ListBase

  • ListLabel

  • Loader

  • Menu

  • MenuBar

  • NavigationBar

  • NumericStepper

  • OLAPDataGrid

  • Panel

  • PieChart

  • PlotSeries

  • PopUpButton

  • ProgressBar

  • RadioButton

  • Repeater

  • Rule

  • ScrollBar

  • ScrollBase

  • Slider

  • TabNavigator

  • TextArea

  • TitleWindow

  • ToggleButtonBar

  • Tree

  • UIMovieClip

  • VideoDisplay

  • ViewStack

Many API methods can be added using the Adobe Flex Functional Test Module Tree View. Additional methods can be added using the Java Code view. Use Ctrl-space in the Java Code view to open an Intellisense window listing available procedures. See the API Reference in the OpenScript help for additional programming information.