Cogitek

Getting Started with HTML application testing

This document will help you get up and running with RIATest, a powerful cross-browser test automation tool for Web applications.

A sample project demonstrating basic automation of HTML application is located in C:\Program Files\RIATest 6\samples\html\HtmlComponents (Mac OS X: /Applications/RIATest 6/samples/html/HtmlComponents). Another sample demonstrating automation of HTML5 elements such as videos, canvas, new input types, etc. is located in C:\Program Files\RIATest 6\samples\html\Html5 (Mac OS X: /Applications/RIATest 6/samples/html/Html5).

Before you begin

System Requirements

In order to use RIATest to automate testing of your Web application you need:
  • Microsoft Windows XP SP2, Vista, Server or Windows 7 or 8 or Mac OS X 10.8.1+
  • Mozilla Firefox 18+, Google Chrome 18+ or Internet Explorer 8+.
  • Optional: Windows UI Automation API 3.0 (Required if you want to automate Windows GUI objects).


Creating a RIATest project

First create a RIATest project.

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

    New Project Wizard
  2. Select project type "HTML application testing", specify a project name and a folder to store the project:
  3. In Application URL or File specify one of the following:
    • Location of your application's HTML file, e.g. http://localhost/myapp/app.html
    • File path of the HTML file, e.g. C:\My Projects\My App\app.html.
  4. Click OK to close the window and create the project.
  5. Select Run, Launch Application.
    The browser launches with your application loaded in the browser window. The RIATest IDE title bar displays "Launched" and then eventually "Ready".
  6. Switch back to RIATest IDE and verify that its title bar shows "Ready" and that the message log shows the following lines:
    Launching "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -P riatest -no-remote ...
    Application launched.

Recording scripts

To record a script

  1. Confirm that RIATest IDE shows 'Ready' in the title.
  2. In RIATest IDE, select Project, Add New Script. Enter a name and click Save.
  3. Select Run, Start Recording.
    RIATest IDE title now show "Recording".
  4. In your application window, perform the test actions. If required, generate checkpoints (see below).
    The RIATest IDE 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 IDE 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 blue frame. See for example "Item A" in the below picture:
    Auto Check Point

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

  1. In RIATest Object Inspector window, 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 Object Inspector window, click Verify button and select Verifty Properties menu item.
    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 IDE, 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 IDE, click Inspect then hover the mouse over a component in the browser window.
    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:

    Inspect

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 IDE, select File, Open Project and select your project.
  2. Select Run, Run Without Debugging.
    The browser window opens with your application loaded. RIATest IDE replays the recorded actions and checkpoints, recording the results in the Message Log.

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

 

Debugging tests

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

To start a debugging session

  1. In RIATest IDE, 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 JavaScript, for writing test scripts. The basic language elements of RIAScript are almost exactly the same as in JavaScript. You can declare and assign values to variables, make function calls, and write conditional and loop statements. For more details see RIAScript Reference Guide.

Problems?

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

 

You are here RIATest Documentation Getting Started Testing HTML applications