RIATest Documentation Copyright © RIATest.com

Getting Started

This document will help you get up and running with RIATest (pronounced "ree-ah-test"), a powerful 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\samples\components.

Before you begin

System Requirements

In order to use RIATest to automate testing of your Adobe Flex application you need:

Choosing application loading scheme

There are two ways automate your application:

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.

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. Upload the contents of C:\Program Files\RIATest\loader to your web server (usually to the same directory as your main application SWF file).
  2. Open your browser at the following location (making the appropriate substitutions.):
    http://your-server-name/your-directory/RIATestLoader.html?rtLoadURL=url-of-your-application.swf
    RIATest Loader should open, then load and run your application.
  3. Close the browser.

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

Embedding RIATest Agent at compile time

If you decide to embed RIATest Agent at compile time, do the following:

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

  1. Open your application project in Flex Builder 3.
  2. Select Project, Properties, Flex Compiler.
  3. In Additional compiler arguments add:
    -include-libraries "C:\Program Files\RIATest\agent\RIATestAgent.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\automation.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\automation_agent.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\frameworks\libs\automation_dmv.swc"

    In the above, if required, replace “C:\Program Files\Adobe\Flex Builder 3” with the correct location for Flex Builder 3 and replace “C:\Program Files\RIATest” with the correct RIATest installation directory.

    Note: See below for the Flex 2 compiler arguments.

  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 Agent – Not connected”. This is expected at this stage.

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

Compiler arguments for Flex 2 applications

If you are automating Flex 2 applications, use the following Additional compiler arguments instead of those given in the above procedure:

-include-libraries"C:\Program Files\RIATest\agent\RIATestAgent2.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\2.0.1\frameworks\locale\en_US\automation_rb.swc" "C:\Program Files\Adobe\Flex Builder 3\sdks\2.0.1\frameworks\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"

Creating a RIATest project

Now create a RIATest project.

  1. Run RIATest Tool and select File, New Project.
    An empty project is created.
  2. Select File, Save All, specify a name and location and click Save.
  3. Select Project, Options and select all checkboxes.
  4. 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, in Application URL, enter…
    • RIATest Loader
    • SWF file on local drive
    “In browser, using local loader” Not applicable.
    • RIATest Loader
    • Application on web server
    “In browser, standalone application or using remote loader” http://your-server-name/your-directory/RIATestLoader.html?rtLoadURL=url-of-your-application.swf
    • RIATest Agent embedded at compile time
    “In browser, standalone application or using remote loader” 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 or other application type (e.g. standalone exe loading SWF)
    • RIATest Agent embedded at compile time
    “Without browser, standalone exe or AIR application” File path of the exe or AIR application, e.g. C:\My Projects\My App\myapp.exe.
  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”'.
  6. Switch back to RIATest Tool and verify that its title bar shows “Ready” and that the message log shows the following lines:
    Launching C:\Program Files\Internet Explorer\iexplore.exe "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

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.
  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. Its class, name and all available properties are displayed.
  2. Click anywhere to exit “inspect mode”.

Playing back test scripts

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

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 3 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:

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.