## WorkShop Visual Replay Command Syntax - Non-application operations

#### Keywords

- delay - pause replay of user actions
- message - print message
- sequence - label part of a script
- shell - execute shell command
- setenv - set shell environment variable
- breakpoint - specify breakpoint in script
- exit - exit from script

#### Synopsis

        delay duration
        message text
        sequence text
        shell command
        setenv env-var env-value
        breakpoint widget
        exit status

#### Inputs

- duration - time in seconds
- text - a text string
- command - an executable command
- env-var - the name of an environment variable
- env-value - the value to assign to an environment variable
- widget - the name of a widget
- status - either 1 or 0

#### Description

delay allows you to insert a pause in a script. This is useful when you wish to visually inspect the application at particular points in its execution. The next action in the script will continue after the pause.

message displays a message on standard error. This allows you to label different parts of the script and communicate expected results and errors to testers. The message text does not have to be enclosed in quotes.

sequence is used to label different sections of a script. Then if an error occurs, you can skip to the next labelled sequence and continue from that point.

To use sequence, you must invoke visu_replay with the skiponerror flag. By default, visu_replay is run with the useronerror flag which will stop the test and stay in the application when an error occurs. The remaining error flag, exitonerror causes will terminate the application when an error occurs.

shell executes a shell command from a script. The script continues when the shell command has terminated. This facility allows you to enrich your scripts to do far more than simply re-running user actions.

setenv is used in conjunction with the shell command to pass information to the shell through environment variables. setenv has two arguments. The first is the name of the variable; the second is an expression that can combine widget resource values and one of the following convenience functions:

- WindowId(widget)

- WindowFrame(widget)

- Parent(widget)

- Shell(widget)

breakpoint is used, in conjunction with a debugger, to set a breakpoint in a script when a nominated widget is activated. You can then examine the internals of individual widgets.

A script which contains the breakpoint keyword should be invoked as follows:

        visu_replay -f script debugger app

where script is the name of the script, debugger is the name of your debugger and app is the name of the application to be exercised by the script. The debugger is run by WorkShop Visual Replay. At the breakpoint keyword, the application will stop as if you set the breakpoint directly. This will allow you to inspect widget internals even if your application has been optimized.

exit terminates the script with the specified exit status.

#### Examples

To delay for 5 seconds after pushing a widget:

        in ApplicationShell
    	push mywidget
    	delay 5
    	push yourwidget

To take a screen dump of a shell without window manager decorations:

        in ApplicationShell
    	setenv ID WindowId(ApplicationShell)
    	shell xwd -id $ID -out /tmp/shell.xwd

To take a screen dump with window manager decorations:

        in ApplicationShell
    	setenv ID WindowFrame(ApplicationShell)
    	shell xwd -id $ID -out /tmp/shell.xwd

To take a screen dump of a pulldown menu, when you only know the name of its cascade button:

        in ApplicationShell
    	push cascade_button
    	setenv ID WindowId(cascade_button->subMenuId)
    	shell xwd -id $ID -out /tmp/shell.xwd

Note - If you don't push the button first, the menu will not have been posted and xwd will not be able to snapshot it.

To do the same with an OptionMenu:

        in ApplicationShell
    	push option_menu.OptionButton
    	setenv ID WindowId(option_menu->subMenuId)
    	shell xwd -id $ID -out /tmp/shell.xwd

To note the background color of the cascade button's parent:

        in ApplicationShell
    	setenv ID Parent(cascade_button)->background
    	shell echo The Color $ID

See also:

- WorkShop Visual Replay Command Syntax