Tool Mentors > Rational Robot Tool Mentors > Creating Test Scripts Using Rational Robot

Purpose

This tool mentor describes how to use Rational Robot to record test scripts and how to extend them by editing the scripts after they have been recorded.

Related Rational Unified Process™ information:

Overview

This tool mentor is applicable when running Microsoft Windows 95/98/2000/NT 4.0.

To record and extend a script using Rational Robot:

  1. Record the script in Rational Robot
  2. Insert a verification point
  3. Edit the test script if necessary

1. Record the script in Rational Robot To top of page

When you record a script, Rational Robot records:

  • Your actions as you interact with the application-under-test. These user actions include keystrokes and mouse clicks that help you navigate around the application.
  • Verification points that you create to capture and save information about specific objects. A verification point is a point in a script that you create to confirm the state or behavior of an object across builds. During recording, the verification point captures object information and stores it as the baseline. During playback, the verification point recaptures the object information and compares it to the baseline.

The recorded script establishes the baseline of expected behavior for the application-under-test. When revised builds of the application become available, you can play back the script to test new builds of the application against the established baseline in a fraction of the time it would take to perform the testing manually.

The Rational Robot Object-Oriented Recording technology examines objects in the application-under-test at the Windows layer during recording and playback. As a result, script playback does not usually depend on absolute screen coordinates. Object-Oriented Recording insulates the script from minor user interface changes and simplifies script maintenance.

To record a new script:

1. Prepare the test environment by setting the record options. See Tool Mentor: Setting up the Test Environment in Rational Robot.
Start your application-under-test. (Optionally, you can start the application-under-test after you start recording by clicking Insert > Start Application in Robot.)
2. Click the Record GUI Script button on the Robot toolbar.
3. Type a name (40 characters maximum) or select it from the list.
4. To change the recording options, click Options. When finished, click OK.
5. If you selected a previously defined or recorded script, you can change the properties by clicking Properties. When finished, click OK.
6. Click OK to start recording. The following events occur:
  • If you selected a script that has already been recorded, Robot asks if you want to overwrite it. Click Yes. (If you record over an existing GUI script, you overwrite the script file but any existing properties are applied to the new script.)
  • Robot is minimized (default behavior).
  • The floating GUI Record toolbar appears. You can use this toolbar to pause or stop recording, redisplay Robot, and insert features into a script.
7. Execute the test by performing the actions identified in the test and insert the necessary features (such as verification points, comments, and timers). For details, see the Robot online Help.
8. If necessary, switch from Object-Oriented Recording to low-level recording.
Object-Oriented Recording examines Windows GUI objects and other objects in the application-under-test without depending on precise timing or screen coordinates. Low-level recording tracks detailed mouse movements and keyboard actions by screen coordinates and exact timing.
9. When finished, click the Stop Recording button on the GUI Record toolbar. The following events occur:
  • The script you recorded appears in a Script window within the Robot main window.
  • The verification points in the script (if any) appear in the Asset pane on the left.
  • The text of the script appears in the Script pane on the right.
  • When you compile or play back the script, the compilation results appear in the Build tab of the Output window.
10. Optionally, set the properties for the script by clicking File > Properties.

2. Insert a verification point To top of page

To insert a verification point while recording or editing a script:

  1. Do one of the following:
  • If recording, click the Display GUI Insert Toolbar button on the GUI Record toolbar.
  • If editing, position the pointer in the script and click the Display GUI Insert Toolbar button on the Standard toolbar.
  1. Click a verification point button on the GUI Insert toolbar.
  2. The verification point is named with the verification point type (and a number if there is more than one of the same type in the script).

  3. Edit the name as appropriate.
  4. Optionally, set the wait state options.
  5. Optionally, set the expected results option.
  6. Click OK.
  7. If prompted to select an object, drag the object finder tool over the desired object and release the left mouse button to select the object. Optionally, the object may be selected from a list of objects by clicking on the Browse button. When the desired object is selected, click OK.

For further details, see the Robot online Help. See also the chapter titled "Creating Verification Points in GUI Scripts" in the Using Rational Robot manual.

3. Edit the test script if necessary To top of page

You can edit existing scripts by manually changing the text of a script or by adding new features. For example, you can:

  • Edit the text of a script (delete a line, move text, and so forth)
  • Add a new user action to an existing script (select a menu command, click a button, and so on)
  • Add a new feature to an existing script (add verification points, comments, and the like)
  • Go to a line with a compiler error (go to a specific line number, find the next error, and so forth)

For details, see the Rational Robot online Help. See also the chapter titled "Editing, Compiling, and Debugging Scripts" in the Using Rational Robot manual.

 

Copyright  © 1987 - 2001 Rational Software Corporation

Display Rational Unified Process using frames

Rational Unified Process