Getting Started with Flex application testing

This document will help you get up and running with RIATest (pronounced "ree-ah-test"), a powerful cross-browser test automation tool for Adobe Flex applications.

A sample project demonstrating basic automation for most built-in Flex classes is located in C:\Program Files\RIATest 6\samples\components (Mac OS X: /Applications/RIATest 6/samples/components).

Before you begin

System Requirements

In order to use RIATest to automate testing of your Adobe Flex application you need:
  • Adobe Flex Builder 3 Professional or Flash Builder 4.x Premium
  • Adobe Flash Player 9,0,115,0 or newer
  • Microsoft Windows XP SP2, Vista, Server or Windows 7 or 8 or Mac OS X 10.8.1+
  • Mozilla Firefox 18+, Google Chrome 18+, Internet Explorer 8+ (Windows only) or Safari (Mac OS X only)
  • Optional: Windows UI Automation API 3.0 (Required if you want to automate Windows GUI objects).


Warning! Automation enabled applications expose all properties of all GUI components. This makes them vulnerable to malicious use.

Never make automation enabled application publicly available. Always restrict access to such applications and to RIATest Loader to trusted users only.

Choosing application loading scheme

There are two ways automate your Flex application:

  • Use RIATest Runtime Loader: The simplest approach, this does not require you to compile your application with automation libraries. However, not all applications can use this.
    Flex 2 applications cannot be automated using runtime Loader.
  • Embed RIATest Agent at compile time (Recommended): This is recommended for all applications and is mandatory for applications that cannot work with runtime Loader, such as those that require a custom HTML wrapper and are impossible to load as a plain SWF file. It involves statically compiling RIATest Agent and automation libraries with your application (see below).

Using RIATest Loader

Depending on the location of your application SWF file, you can use RIATest Loader locally or remotely.

Using RIATest Loader Locally

If the application runs from a local disk, no special actions are needed.

  • When creating a RIATest project, specify 'In browser, using local Loader' and select correct Flex SDK version that the application is complied with.

Using RIATest Loader Remotely

If the application runs from a web server, upload RIATest Loader to the server. This enables the same domain name to serve both RIATest Loader and your application's URLs. Otherwise, security policy will not allow RIATest Loader to access your application.

  1. Go to RIATest installation directory and upload the contents of loader/sdkN.N directory to your web server (usually to the same directory as your main application SWF file) where N.N is Flex SDK version that the application is compiled with.
  2. Open your browser at the following location (making the appropriate substitutions):
  3. Type in the application swf file URL relative to RIATestLoader.html URL and click "Load" button.
    RIATest Loader should open, then load and run your application.
  4. Close the browser.

Now create a RIATest project (see below, "Creating a RIATest project").

Embedding RIATest Agent at compile time

If you decided to use static compilation of automation libraries and embed RIATest Agent perform the following steps:

  1. Open your application project in Flex Builder 3 or Flash Builder 4.
  2. Select Project, Properties, Flex Compiler. Flex Compiler options appear:

    Additional Compiler Arguments
  3. In Additional compiler arguments add the following (depending on version of Flex SDK you use):

    If your application is compiled with Flex SDK version Add compiler arguments...
    SDK 2.x -include-libraries "C:/Program Files/RIATest 5/agent/RIATestAgent2.swc" ${flexlib}/locale/en_US/automation_rb.swc ${flexlib}/libs/automation.swc "C:/Program Files/Adobe/Flex Builder 3/sdks/3.0.0/frameworks/libs/2.0.1.automation_swcs/automation_agent.swc" "C:/Program Files/Adobe/Flex Builder 3/sdks/3.0.0/frameworks/libs/2.0.1.automation_swcs/automation_agent_rb.swc"
    SDK 3.0 to 3.6 -include-libraries "C:/Program Files/RIATest 6/agent/RIATestAgent3.swc" ${flexlib}/libs/automation.swc ${flexlib}/libs/automation_dmv.swc ${flexlib}/libs/automation_agent.swc

    SDK 4.0, 4.1

    -include-libraries "C:/Program Files/RIATest 6/agent/RIATestAgent4.swc" ${flexlib}/libs/automation/automation.swc ${flexlib}/libs/automation/automation_dmv.swc ${flexlib}/libs/automation/automation_agent.swc ${flexlib}/libs/automation/automation_spark.swc

    For AIR applications in addition to the above libraries also specify ${flexlib}/libs/automation/automation_air.swc ${flexlib}/libs/automation/automation_airspark.swc

    SDK 4.5, 4.6, 4.8, 4.9

    -include-libraries "C:/Program Files/RIATest 6/agent/RIATestAgent45.swc" ${flexlib}/libs/automation/automation.swc ${flexlib}/libs/automation/automation_dmv.swc ${flexlib}/libs/automation/automation_agent.swc ${flexlib}/libs/automation/automation_spark.swc

    For AIR applications in addition to the above libraries also specify ${flexlib}/libs/automation/automation_air.swc ${flexlib}/libs/automation/automation_airspark.swc

    In the above, if required, replace "C:/Program Files/RIATest 5" with the correct RIATest installation directory.
    Mac OS X: The following is the default path to agent folder: /Applications/RIATest 6/agent/
  4. Click OK to save your changes and close the dialog box.
  5. Compile your application.
    RIATest Agent and Flex automation libraries are now embedded in your application. Whenever your application starts, RIATest Agent will attempt to connect to RIATest Tool in order to establish an automation session.
  6. Run your application.
    You should see the RIATest Agent toolbar floating over your application. The toolbar title should read "RIATest - Not connected". This is expected at this stage.

    RIATest Agent Toolbar

Creating a RIATest project

Now create a RIATest project.

  1. Run RIATest Tool and select File, New Project.
    "New Project" window appears:

    New Project Wizard
  2. Select project type "Flex application testing", specify a project name and a folder to store the project:
  3. Specify one of the following, depending on your application loading scheme (see "Choosing your application loading scheme", above):

    If your scheme is... Select this... And enter...
    • RIATest Loader
    • SWF file on local drive
    "In browser, using local Loader"

    In Application SWF File enter path of the swf, e.g. C:\My Projects\My App\myapp.swf

    Select the version of Flex SDK that your application is compiled with.

    • RIATest Loader
    • Application on web server
    "In browser, using remote Loader"

    In Remote Loader URL enter URL of the RIATestLoader.html which you uploaded to your server, e.g.:


    In Application SWF File URL enter url-of-your-application.swf relattive to RIATestLoader.html.

    • RIATest Agent embedded at compile time
    "In browser Flex or HTML applicaiton" In Application URL or File one of the following:
    • Location of your application's wrapper HTML file, e.g. http://localhost/myapp/bin/app.html
    • File path of the wrapper HTML file, e.g. C:\My Projects\My App\bin\app.html.
    • AIR application
    "AIR application"

    In Application XML File enter path of the AIR application xml file, e.g. C:\My Projects\MyApp\bin-debug\MyApp-app.xml

    Note: RIATest will use AIR Debug Launcher (ADL) to launch your AIR application.

    • Other application type (e.g. standalone EXE loading SWF or AIR application installed as EXE)
    • RIATest Agent embedded at compile time
    "Without browser, standalone executable" In Application File enter path of the executable, e.g. C:\My Projects\My App\myapp.exe.
  4. Click OK to close the window and create the project.
  5. Select Run, Launch Application.
    The default browser launches with your application loaded in the browser window. The RIATest Agent title bar displays "Connecting" and then eventually "Ready":

    First Launch
  6. Switch back to RIATest Tool and verify that its title bar shows "Ready" and that the message log shows the following lines:
    Launching iexplore.exe "file://C:/My Projects/My App/bin/app.html"
    Application launched.
    Waiting for connection from agent...
    Agent connection accepted.

Recording scripts

To record a script

  1. Confirm that RIATest Tool and RIATest Agent are connected (both should show 'Ready' in their titles).
  2. In RIATest Tool, select Project, Add New Script. Enter a name and click Save.
  3. Select Run, Start Recording.
    RIATest Tool and RIATest Agent titles now show "Recording".
  4. In your application window, perform the test actions. If required, generate checkpoints (see below).
    The RIATest Tool records actions as statements in the Test Script window.
  5. To stop recording, select Run, Stop Recording.
  6. Select Run, Terminate Application to close the browser window containing your application.

Generating checkpoints

While recording a script, you can generate checkpoints. A checkpoint stores the values of the selected component. During playback, RIATest Tool compares the current values with those stored in the checkpoint and reports accordingly (see below).

You can hand-code checkpoints, but it is simpler to generate them during the recording process.

To automatically generate a checkpoint

  • Hold down CTRL+SHIFT and click the component.
    The new checkpoint is based on those values of the component's properties that are designated for default verification.

    TIP: With CTRL+SHIFT held down, hovering the mouse over an element highlights it with a green frame:

    Auto Check Point

To generate a checkpoint based on a selection of the component's properties

  1. In RIATest Agent, click Inspect then hover the mouse over a component.
    A blue frame highlights the component. Its class, name and all available properties are displayed.
  2. Click on your chosen component.
  3. In RIATest Agent, click Verify.
    The selected component's properties are displayed:

    Verify Properties
  4. Use the checkboxes to include properties in the checkpoint.
  5. Click OK.
    The resulting checkpoint stores the values of the selected properties, only.

Editing your recording

You can stop and restart a recording at any time. This enables you to correct any mistakes.

To delete mistakes

  1. If you have not already done so, in RIATest Tool, select Run, Stop Recording to stop the recording.
  2. Select the unwanted actions and delete them.
  3. Select Run, Start Recording.

Inspecting the components

RIATest provides an easy way to browse GUI elements during recording.

  1. In RIATest Agent, click Inspect then hover the mouse over a component.
    A blue frame highlights the component
  2. Click anywhere to exit "inspect mode". The inspector window will be shown and the class, name and all available properties of the selected component are displayed:


Playing back test scripts

When you play back a test script, the Message Log reports the results.

  • Successfully passed checkpoints generate green messages.
  • Failed actions and checkpoints generate red messages.

The Message Log also shows the number of scripts that ran without any errors, and the number of scripts that encountered problems.

To run a test script

  1. In RIATest Tool, select File, Open Project and select your project.
  2. Select Run, Run Without Debugging.
    The browser window opens with your application loaded. RIATest Tool replays the recorded actions and checkpoints, recording the results in the Message Log.

After playback finishes, your application terminates and the browser window closes.

Note: If you are using Flex/Flash Builder Trial, your playback is limited to 30 actions. To remove this limit, acquire a Flex Builder 3 Professional license from Adobe.


Debugging tests

If you encounter unexpected errors during playback, you can debug your scripts.

To start a debugging session

  1. In RIATest Tool, select Run, Run Tests.
    Scripts run as usual. If any problems are encountered (such as checkpoint or action failure), the script suspends with the problem line highlighted.
  2. Do one or more of the following:
    • Inspect the most recent message in Message Log. This usually explains the problem (e.g. Expected vs. Actual values will be shown for a failed checkpoint).
    • Hover the mouse over variable names to examine their values.
    • Switch to your application and inspect components and their properties.

Writing test scripts manually

Sometimes you will need to perform sophisticated tests such as repeating the same sequence of user actions, or conditionally executing actions depending on the state of your application. For these, recording a script is not suitable - you need to write one manually.

RIATest tool uses RIAScript, a language similar to ActionScript, for writing test scripts. The basic language elements of RIAScript are almost exactly the same as in ActionScript. You can declare and assign values to variables, make function calls, and write conditional and loop statements. For more details see RIAScript Reference Guide.


Please see the current list of known lissues. For other issues please contact RIATest helpdesk.


You are here RIATest Documentation Getting Started Testing Flex applications