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:
- Adobe Flex Builder 3 Professional
- Adobe Flash Player 9,0,115,0 or newer
- Microsoft Windows 2000, XP or Vista
- Mozilla Firefox 2+ or Internet Explorer 6+
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.
- Upload the contents of C:\Program Files\RIATest\loader to your web server
(usually to the same directory as your main application SWF file).
- 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.
- 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:
- Open your application project in Flex Builder 3.
- Select Project, Properties, Flex Compiler.
- 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.
- Click OK to save your changes and close the dialog box.
- 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.
- 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.
- Run RIATest Tool and select File, New Project.
An empty project is created.
- Select File, Save All, specify a name and location and click Save.
- Select Project, Options and select all checkboxes.
- 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.
|
- 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”'.
- 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
- Confirm that RIATest Tool and RIATest Agent are connected (both should
show 'Ready' in their titles).
- In RIATest Tool, select Project, Add New Script. Enter a name and click
Save.
- Select Run, Start Recording.
RIATest Tool and RIATest Agent titles now show “Recording”.
- 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.
- To stop recording, select Run, Stop Recording.
- 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.
To generate a checkpoint based on a selection of the component’s properties
- 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.
- Click on your chosen component.
- In RIATest Agent, click Verify.
The selected component’s properties are displayed.
- Use the checkboxes to include properties in the checkpoint.
- 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
- If you have not already done so, in RIATest Tool, select Run, Stop Recording
to stop the recording.
- Select the unwanted actions and delete them.
- Select Run, Start Recording.
Inspecting the components
RIATest provides an easy way to browse GUI elements during recording.
- 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.
- Click anywhere to exit “inspect mode”.
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
- In RIATest Tool, select File, Open Project and select your project.
- 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
- 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.
- 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.