A Phantom script can be created with any ASCII text editor. However,
the PTD script editor provides some useful features to aid in script
development and debugging.
Features
The script editor performs several features useful to editing and
creating scripts. It employs a keyword colorizer, highlighting variable
types, keywords, comments and strings as colored words. There is also
a line number indicator on the left side of the editor. Errors and
warnings from Phantom display both the file name and the line number,
making the line number indicator a useful tool for resolving errors
and warnings.
The script editor integrates with the Window
Declarations Editor by supporting a drag-and-drop capability.
Window declarations and window declarations files can be inserted
into a script simply by clicking the declarations and dragging them
into the script. The necessary information is inserted in place.
The edit menu also provides features for copying,
pasting and searching the text of the script. For more information.
The line number indicator is used for debugger breakpoint and current
line indicators. For more information, see the Debugger.
Opening a Script
The script editor opens with an empty untitled script when PTD starts.
Additional scripts can be opened in the editor by selecting ‘File’
then ‘Open’ from the main menu. New scripts can be created
by selecting ‘File’ then ‘New’ from the main
menu. New scripts will open as a blank document labeled ‘Untitled’.
All scripts will appear as a new script editor tab in the user interface.
A script can also be opened from the Suite view. Right-click on a
testcase and select ‘Edit’ from the popup menu. The script
associated with the testcase will open in a new script tab.
If a workspace is opened either manually
or automatically when PTD starts, all scripts open the last time the
workspace was used will automatically be opened.
Editing a Script
Scripts can be edited directly in the script editor. This is similar
to any ASCII text editor. Support for copying, cutting, pasting, and
searching is supplied through the edit menu.
Note that changes to the script do not become active until the script
is saved. If a script is edited, an asterisk (*) appears next to the
name in the script tab, indicating the contents of the window have
changed. This will cause a save prompt to appear if PTD is closed
or the script is closed.
Saving a Script
Changes to a script can be saved by using the ‘Save’ or
‘Save As’ menu items from the main
menu. Scripts are saved as standard ASCII text. Changes are not
active until the script is saved.
Closing a Script
To close a script, click on the ‘x’ next to the script
name in the script tab. Additionally, a script can be closed by selecting
'File' then 'Close' from the main menu. All
scripts can be closed by selecting 'File' then 'Close All' from the
main menu.
Printing a Script
A script can be sent to the printer by selecting ‘File’
then ‘Print’ from the main menu.
The script to be printed must be selected and contain the keyboard
cursor. The script and line numbers will be sent to the selected printer.