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

Purpose

This tool mentor describes how to use Rational Robot to record or program Test Scripts, and how to subsequently extend them by editing the Test Scripts.

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 Test Script in Rational Robot
  2. Insert a verification point
  3. Edit the test script if necessary

1. Record the Test Script in Rational Robot To top of page

When you record a Test 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 compare information about the state of specific system components. A verification point is a point in a Test Script at which you determine you should confirm the state or behavior of an element of the Target Test Items across Builds. During Test Script recording, the verification point captures information about the system state and stores it as a baseline of expected results. During Test Script playback, the verification point recaptures the same system state information and compares it to the information stored in the baseline.

The recorded Test Script establishes the baseline of expected behavior for the Target Test Items. When revised builds of the Target Test Items become available, you can execute the Test Script against the subsequent Builds and the comparison of system state information in the verification point usually occurs in a fraction of the time it would take to perform the comparison manually.

The Rational Robot Object-Oriented Recording technology examines system state information at the Windows layer during initial Test Script recording and subsequent playback. As a result, sucessful Test Script playback does not usually need to rely on absolute screen coordinates. Object-Oriented Recording insulates the Test Script from minor user interface changes and simplifies Test Script maintenance.

To record a new Test 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 Test 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 Test Scripts by manually editing the source code of a Test Script or by inserting new partial recordings. For example, you can:

  • Edit the text of a Test Script (delete a line, move text, and so forth)
  • Insert a new sequence of user action into an existing Test Script (select a menu command, click a button, and so on)
  • Add a new feature to an existing Test 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