| Article Index |
|---|
| IBM Rational Robot Editing, Compiling, and Debugging Scripts |
| Page 2 |
| All Pages |
This chapter explains how to edit, print, and compile GUI and virtual user scripts,
and how to debug GUI scripts. It includes the following topics:
· Editing the text of a script
· Adding a user action to an existing GUI script
· Adding a feature to an existing GUI script
· Working with low-level scripts
· Saving scripts and SQABasic files
· Printing a script or SQABasic file
· Compiling scripts and SQABasic library source files
· Debugging GUI scripts
· Deleting scripts
Editing the Text of a Script
You can edit the text of any open script. You might want to edit a script to change a command argument or to add conditional logic using the SQABasic language (for GUI scripts) or the VU language (for virtual user scripts). For information about these languages, see the SQABasic Language Reference and the VU Language Reference.
The Rational Robot Edit menu commands use standard Windows mouse and pointer techniques for selecting text. In addition, you can use standard Windows
shortcut keys instead of the mouse to select menu commands. Shortcut keys are listed next to the corresponding Edit menu commands.
Before starting to edit, you must have a script open. The script can be:
· A script you have just recorded.
· A script you have opened.
To edit the text of a script, use the Edit menu commands or toolbar buttons.
Some of the Edit menu commands are disabled if you are debugging. To stop debugging, click Debug > Stop.
NOTE: By default, the FixedSys font used by Robot does not display the Euro symbol. To fix this, change the font to Courier or another font that supports the
Euro symbol.
Adding a User Action to an Existing GUI Script
User actions are actions, such as keystrokes and mouse clicks, that help you navigate around the application. After you record a script, you might decide to add new user
actions, such as selecting a menu command, to the script.
To add a new action to an existing script:
1. If necessary, open the script by clicking File > Open > Script.
2. If you are currently debugging, click Debug > Stop.
3. In the Script window, click where you want to insert the new actions. Make sure that the application-under-test is in the appropriate state to begin recording at
the text cursor position.
4. Click the Insert Recording button on the Standard toolbar.
The Robot window minimizes by default or behaves as specified in the GUI Record Options dialog box.
5. Continue working with the application-under-test as you normally do when recording a script.
Adding a Feature to an Existing GUI Script
Features you might want to add to an existing script include verification points, timers, and comments. You can easily add these features while you are recording a script or after you finish recording.
To add a feature to an existing GUI script:
1. If necessary, open the script by clicking File > Open > Script.
2. If you are currently debugging, click Debug > Stop.
3. In the Script window, click where you want to insert the feature. Make sure that the application-under-test is in the appropriate state to insert the feature at the
text cursor position.
4. Do one of the following:
-
-
To add the feature without going into recording mode, click the Display GUI Insert Toolbar button on the Standard toolbar. The Robot Script window remains open.
To start recording and add the feature, click the Insert Recording button on the Standard toolbar. The Robot window minimizes by default, or behaves as specified in the GUI Record Options dialog box. Click the Display GUI Insert Toolbar button on the GUI Record toolbar.
5. Click the appropriate button on the GUI Insert toolbar.
NOTE: The following features are not on the GUI Insert toolbar: File Comparison, File Existence, Module Existence, and Delay. To add these features to your script, open the Robot window if necessary (by clicking the Open Robot Window button on the GUI Record toolbar). Click the Insert menu, and then click the appropriate command.
6. Continue adding the feature as usual.
Working with Low-Level Scripts
Robot has two recording modes:
· Object-Oriented Recording mode
· Low-level recording mode
If you turn on low-level recording, Robot tracks detailed mouse movements and keyboard actions by screen coordinates and exact timing. Robot records these low-level actions in a binary script file. You can view an ASCII version of this binary file. You can also rename, copy, or delete the file.
A low-level script is stored in the project and is always associated with a Robot script. When you create a low-level script, its name appears in the Asset pane of the Script
window. If you delete a Robot script, its associated low-level scripts are also deleted.
Viewing Low-Level Scripts
You cannot edit the low-level binary file, but you can use Notepad to view an ASCII version of the binary file.
To view the low-level script file:
1. In the Asset (left) pane of the Script window, expand Low-Level Scripts if necessary by clicking the plus sign (+).
2. Double-click the number of the low-level script that you want to view in
The low-level ASCII file lists the actions that occurred during low-level recording. For information about the contents of this file, see low-level recording in the Robot
Help Index.
Renaming a Low-Level Script
When you record a low-level script, it is stored in the project. You can rename the low-level script if needed. Renaming a low-level script involves two tasks:
· Renaming the low-level script in the Asset pane, which renames it in the project.
· Renaming all references to that low-level script in the script.

When you rename a low-level script in the Asset pane, Robot does not automatically rename references to it in the script. If you play back a script that refers to a low-level script with a name that is not in the Asset pane (and therefore is not in the project), the script fails.
To rename a low-level script:
1. Right-click the low-level script name in the Asset (left) pane and click Rename.
2. Type the new name and press ENTER.
3. Click the top of the script in the Script (right) pane.
4. Click Edit > Replace.
5. Type the old name in the Find what box. Type the new name in the Replace with box.
6. Click Replace All.
Copying a Low-Level Script
You can copy a low-level script to the same script or to a different script in the same project. Copying a low-level script involves two tasks:
· Copying the low-level script name in the Asset pane in one script and pasting it into the Asset pane in the same script or a different script. This puts a copy of
the low-level script in the project.
· Copying the low-level script command from the script and pasting it into the same script or a different script.
To copy a low-level script:
1. Right-click the low-level script in the Asset (left) pane and click Copy.
2. In the same script or in a different script (in the same project), right-click Low-Level Scripts in the Asset pane.
3. Click Paste to paste a copy of the low-level script into the project.
If a low-level script with that name already exists, Robot appends a unique number to the name.
You can also copy and paste by dragging the low-level script to Low-Level Scripts in the Asset pane.
4. Click the top of the Script (right) pane of the original script.
5. Click Edit > Find and locate the line with the low-level script name that you just copied.
6. Select the entire line, which starts with PlayJrnl. Click Edit > Copy.
7. Return to the script that you used in step 2. Click the location in the script where you want to paste the line, and then click Edit > Paste.
8. Change the name of the low-level script to match the name in the Asset pane.
Deleting a Low-Level Script
If you no longer need a low-level script, you can delete it. Deleting a low-level script involves two tasks:
· Deleting the low-level script name in the Asset pane (left pane), which deletes the low-level script from the project.
· Deleting the low-level script command from the script. When you delete a low-level script in the Asset pane, Robot does not automatically
delete references to it from the script. If you play back a script that refers to a deleted low-level script, the script fails.
To delete a low-level script:
1. Right-click the low-level script name in the Asset (left) pane and click Delete.
2. Click the top of the script in the Script (right) pane.
3. Click Edit > Find.
4. Type the name of the deleted low-level script in the Find what box.
5. Click Find Next.
6. Delete the entire line, which starts with PlayJrnl.
7. Repeat steps 5 and 6 until you have deleted all references.
Saving Scripts and SQABasic Files
Robot saves a script after you define it or record it. You can also save any open script or SQABasic file manually.
To save open scripts or SQABasic files, do one of the following:
You can save only within the current project.
Printing a Script or SQABasic File
To print an open script or SQABasic file:
1. If necessary, click File > Page Setup to set up the format of printed output.
To add information to the page header or footer, use print codes. For a description of these codes, click the Help button in the Page Setup dialog box.
2. Click File > Print.
3. Set the print options as needed and click OK.
Robot uses standard Windows Print Setup dialog boxes. For more information, see your Windows documentation.
Compiling Scripts and SQABasic Library Source Files
When you play back a GUI script or virtual user script or when you debug a GUI
script, Robot compiles the script if it has been modified since it last ran.
You can also compile scripts and SQABasic library source files manually.
Compiling One or All Scripts and Library Source Files
You can compile the active script or file, or you can compile all scripts and files in the
current project.
Continues in page2
< Prev