Capturing and Replaying Form Input
This feature has been designed to allow Zim application developers to capture form input and later replay the captured keystrokes to simulate typing at the keyboard. The ability to replay form input can aid in testing and debugging applications, and also in producing product demonstrations.
FORM SET SAVE and FORM SET INPUT
There are two commands used to control the capturing and replaying of form input:
- FORM SET SAVE [ON|OFF] to capture form input.
- FORM SET INPUT [ON|OFF] to replay form input.
FORM SET SAVE
- The command FORM SET SAVE ON initiates capturing the keystrokes
- Keystrokes are stored in a script file called zfmkeys in the database directory;
- The file zfmkeys is recreated every time FORM SET SAVE ON is issued;
- Zim stores all keystrokes, including characters, numbers, transmit keys and control characters, executed during FORM INPUT;
- The handling of keystrokes during FORM INPUT form proceeds normally after FORM SET SAVE ON has been issued;
- Issuing the command FORM SET SAVE OFF terminates capturing keystrokes and closes the script file zfmkeys.
FORM SET INPUT
- The command FORM SET INPUT ON initiates replaying the keystrokes stored in the zfmkeys script file;
- Immediately after FORM SET INPUT ON has been issued, Zim starts reading keystrokes from the beginning of zfmkeys;
- Keystrokes are read from the script file rather than the keyboard;
- Zim continues reading keystrokes from zfmkeys until the command FORM SET INPUT OFF is executed or until the end of the file is reached;
- FORM SET INPUT OFF terminates replaying keystrokes and closes the script file zfmkeys, regardless of whether or not the entire script was replayed.
The following steps will produce a form input script for a Zim session that tests a specific section of an application:
Before starting the application, execute the command FORM SET SAVE ON to initiate capturing.
Start the application and proceed normally.
After the application has terminated, execute the command FORM SET SAVE OFF to terminate capturing.
At this point, the script file zfmkeys contains all of the keystrokes you typed during FORM INPUT.
To replay the form input script, return to the point where you executed the FORM SET SAVE ON command and execute instead the command FORM SET INPUT ON to initiate replay.
Then start the application and watch the script replay.
When complete, execute the command FORM SET INPUT OFF to terminate replay.
Other Terminal Input
The capture and replay commands described above affect only FORM INPUT and not other kinds of terminal input processed by Zim.
The following commands are not affected:
- INPUT and PAUSE;
- PAUSE in REPORT commands;
- ADD/CHANGE FROM TERMINAL.
Switching Terminals or Platforms
The form input script file can be produced on one terminal and replayed on another, even if the terminal definitions are dissimilar.
For example, on a UNIX platform, a script file produced by capturing keystrokes from a terminal defined (using ZIMTCAP) as a VT100 terminal, could be replayed later on a terminal defined as an ANSI terminal.
In other words, the script file format is independent of the terminal used to create it.
However, the script file format is dependent on the platform on which it was created. For example, a script file used on a UNIX system cannot currently be replayed on a VAX/VMS system or on a Microsoft Windows system.
Using Multiple Script Files
The form input capture and replay features work with a single script file called zfmkeys. At most one script file can be in use at any time.
However, it is possible to work with many script files simultaneously by using the file copying facilities of the operating system.
For example, after producing a script file you could make a copy of it named myscript.1.
FORM SET SAVE ON
FORM SET SAVE OFF
SYSTEM “cp zfmkeys myscript.1”
The SYSTEM command above uses the UNIX/XENIX/QNX “cp” command to make a copy of the script file. In this manner, many different script files could be produced.
Later, a particular script file could be replayed by first restoring it as the zfmkeys file.
SYSTEM “cp myscript.1 zfmkeys”
FORM SET INPUT ON
FORM SET INPUT OFF
Capturing Should not be Turned on while Replay is on
FORM SET SAVE ON should not be executed while FORM SET INPUT ON is active, otherwise replay will be turned off and capturing initiated (which will erase the old script file).
Replay Should not be Turned on while Capturing is on
FORM SET INPUT ON should not be executed while FORM SET SAVE ON is active, otherwise capture will be terminated and replay initiated.
Replay Should be Turned off once the Last Keystroke in the Script File has been Replayed
FORM SET INPUT OFF should be executed once the script file has been exhausted.