Tool Mentor: Using Rational RobotTM to Record or Program Test ScriptsPurposeThis tool mentor describes how to use Rational RobotTM to record test scripts and how to extend them by editing the scripts after they have been recorded. Related Rational Unified Process activities:
OverviewThis Tool Mentor is applicable when running Microsoft Windows 95/98/NT 4.0. To record and extend a script using Robot:
1. Record the script in Robot
|
| 1. | Prepare to record test scripts by entering test script properties in TestManager. See Tool Mentor: Using Rational TestManager to capture the results of Identify and Structure Test Procedures. |
| 2. | Prepare the test environment by setting the record options. See Tool Mentor: Setting up the Test Environment. |
| Start your application-under-test. (Optionally, you can start the application-under-test after you start recording by clicking Insert > Start Application in Robot.) | |
| 3. | Click the Record GUI Script button on the Robot toolbar. |
| 4. | Type a name (40 characters maximum) or select it from the list. |
| 5. | The scripts that are listed have already been defined in TestManager or recorded in Robot. |
| 6. | To change the recording options, click Options. When finished, click OK. |
| 7. | If you selected a previously defined or recorded script, you can change the properties by clicking Properties. When finished, click OK. |
| 8. | Click OK to start recording. The following events occur: |
|
|
|
|
|
|
| 9. | Execute the test procedure by performing the actions identified in the procedure and insert the necessary features (such as verification points, comments, and timers). For details, see the Robot online Help. |
| 10. | If necessary, switch from Object-Oriented Recording to low-level recording. |
| 11. | 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. |
| 12. | When finished, click the Stop Recording button on the GUI Record toolbar. The following events occur: |
|
|
|
|
|
|
|
|
| 13. | Optionally, set the properties for the script by clicking File > Properties. |
To insert a verification point while recording or editing a script:
- 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.
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).
For further details, see the Robot online Help and the chapter Creating Verification Points in GUI Scripts in the Using Rational Robot manual.
You can edit existing scripts by manually changing the text of a script or by adding new features. For example, you can:
For details, see the Robot online Help and the chapter Editing, Compiling, and Debugging Scripts in the Using Rational Robot manual.
When you play back a script, Robot repeats your recorded actions and automates the software testing. With automation, you can test each new build of your application faster and more thoroughly than by testing it manually. This decreases testing time and increases both coverage and overall consistency.
There are two general phases of script playback:
Before playback, Robot automatically compiles a script if it has changed since it last ran.
For information on preparing the test environment for script playback, see the Tool Mentor: Setting Up the Test Environment.
To play back a script:
The query determines which names and fields appears in the list. To change the list, select a query from the Query drop-down list. You create new queries in TestManager.
- Select a build from the list. To create a new build, click the build button on the right. Builds can also be created in TestManager.
- Select a log folder from the list. To create a new log folder, click the log folder button on the right. Log folders can also be created in TestManager.
- Accept the default log name, which is the same as the script name, or type a new name.
- Click OK.
Note: To stop playback of a script, press the F11 key. Robot recognizes the F11 key only when playing back Object-Oriented commands. The F11 key does not stop playback during low-level actions.
After playback completes, use the Rational LogViewer to view the playback results, including verification point failures, procedural failures, aborts, and any additional playback information.
To control the log information and display of the LogViewer, you can set options in the Log tab in the GUI Playback Options dialog box:
If this is not selected, you can display the LogViewer after playback by clicking Tools > Rational Test > LogViewer.
If the playback of the test scripts resulted in any errors, the specific cause of the error must be identified.
Scripts which contain errors are identified in the LogViewer by the word Fail (enclosed in a red box) in the Results column, or Warning (in a yellow box). There are several classes of errors to be addressed: fatal errors, script errors, and verification point failures. Fatal errors typically require that the test environment should be investigated and the failure resolved. Script errors typically require test script maintenance. Verification point failures (during test implementation) typically require changes to the verification point parameters or indicate a difference between the desired state of the application-under-test when the script was recorded versus when it was played back. See the next section for analyzing verification points.
Additional information regarding the error condition may be viewed in the Log Event Properties window. Open this window by clicking View > Log Event Properties. Selecting the Results tab will display a description of the error and additional information regarding the type of error encountered.
For each script in which a failure (or warning) occurred, review the information regarding the failure and if necessary, edit the test script (see Tool Mentor: Using Rational RobotTM to Record or Program Test Scripts). The test script (and Robot) may be opened from the LogViewer by clicking View > Script.
After editing the script, the environment should be re-set to its appropriate initial state (see Tool Mentor: Setting Up the Test Environment.) and the tests re-executed (Play the script back.)
Use the Comparators to analyze verification point results. To open a Comparator from the LogViewer:
- Copy Property to baseline - copy the current individual actual property and over-write the baseline property.
- Copy All Properties to baseline - copy all the actual property values and over-write all the baseline properties.
- Edit individual property (menu, value, etc.) by double-clicking the property (menu, value, etc.) and entering a different value.
- Editing the properties list (to identify which properties should be captured by the verification point).
- Create / modify masks.
After editing the script and / or verification points, the environment should be re-set to its appropriate initial state (see Tool Mentor: Setting Up the Test Environment.) and the tests re-executed (Play the script back.)
![]()
|
|