WorkShop Visual Replay Command Syntax |
C |
![]() |
The WorkShop Visual Replay script keywords have been divided into the following subsections according to their functions:
ApplicationShell - the top level shell of the application
in shell_widget
commands
in ApplicationShell
commands
shell_widget
|
the name of a shell widget other than the main application shell
|
in ApplicationShell
push this_button
push that_button
push help_dialog_button
in help_dialog_popup
push cancel_button
in ApplicationShell
push another_button
push
|
-
|
press and release a mouse button
|
doubleclick
|
-
|
doubleclick mouse button
|
push widget [with [modifier-]button[1-5]]
doubleclick widget
widget
|
the name of a widget
|
modifier
|
a keyboard modifier
|
button[1-5]
|
the number of the mouse button (default is button 1 with no modifiers).
|
doubleclick simulates a doubleclick with the left mouse button. This can be used in any widget but is especially useful for selecting from a text widget (see the Text Entry section on page 763).
Usage
In some widgets, where the user clicks with the mouse is unimportant. For example, clicking on a button widget in any part of it will activate that button. However, for other widgets, the position is significant; for example pushing on a scale widget will have different effects depending upon the where the push was made.
Position independent widgets |
Position dependent widgets |
Buttons |
Sliders |
Toggles |
Scales |
|
Lists |
|
Drawing Areas |
|
Text Widgets1 |
|
Non-Motif widgets |
1
Recording and replaying user interaction with text widgets is covered in the Text Entry section on page 763
|
Refer to the Button Actions (Position Dependent Controls) section on page 765 for details on recording and replaying the other widgets in the position-dependent list.
Examples
in ApplicationShell
push this_button
in ApplicationShell
push that_button with shift-button2
in my_dialog_popup
if color_toggle->set:true
push color_toggle
endif
C.4 Menu Operations
Keywords
cascade
-
post a pulldown menu
pullright
-
post a pullright menu from a pulldown menu
Synopsis
cascade cascadebutton
select widget
cascade cascadebutton
pullright cascadebutton
Inputs
cascadebutton
the name of a cascadebutton
widget
the name of a widget within the cascade button's pulldown menu
Description
cascade is a shorthand way of describing menu operations. You can also post a menu by pushing on the associated cascade button or using a keyboard accelerator. Similarly, menu options can be selected using accelerators or keyboard mnemonics. Examples
in ApplicationShell
cascade file_m
select open_file
in ApplicationShell
cascade format_menu
pullright character_menu
Notes
WorkShop Visual Replay only supports one level of pullright menu to conform to the Motif style guide. You can however use the push command in your scripts to select pullright menus in succeeding levels.
C.5 Option Menu Operations
Keywords
option
-
select from an option menu
Synopsis
option opmenu-widget::member_widget
Inputs
opmenu-widget
the name of an option menu widget
member-widget
the name of a widget within the option menu's pulldown menu
Description
option selects an option from an option menu. Examples
in ApplicationShell
cascade format_menu
pullright character_menu
option character_menu::bold
The next example only selects an option if the option menu itself is sensitive to user input:if IsSensitive(myoptionmenu->OptionButton)
option myoptionmenu::thisoption
endif
If you want to check the current setting of the optionmenu (i.e. what was last selected), you simply examine the option menu menuHistory resource, for example: if myoptionMenu->menuHistory: select_yes
message he said yes
endif
Notes
An alternative method of selecting a member of an option menu is to push the option button and then push the appropriate member widget. However, we recommend use of the option syntax as it more closely mimics user actions.
C.6 Keyboard Operations
Keywords
alt
-
select current word
ctrl
-
select current line
key
-
enter a keysym from the keyboard
Synopsis
alt char
ctrl char
key keysym
Inputs
char
a single character
keysym
any X keysym (see X11/keysymdef.h for list)
Description
Keyboard input is directed at the widget that has the focus. WorkShop Visual Replay does not require any extra programming to enter input from the keyboard. Example
in ApplicationShell
alt f
type o
in open_file_popup
multiclick selection_field
type foo.xd
push ok_button
doubleclick my_text_field
type hallo world
key Return
Notes
A push or a doubleclick in a text field has the side effect of taking the focus. This is the only place in WorkShop Visual Replay that focus is handled directly.
C.7 Text Entry
Keywords
type
-
enter text from the keyboard
key
-
enter a keysym from the keyboard
doubleclick
-
select current word
multiclick
-
select current line
Synopsis
type text
key keysym
doubleclick textwidget
multiclick textwidget
Inputs
keysym
any X keysym (see X11/keysymdef.h for list) without the XK_ prefix
textwidget
the name of a text widget
text
a text string
Description
Most text widgets in an application are used for single line data entry (for example the selection fields in a File Selection Box). WorkShop Visual Replay allows testers to replace the default content of the field with a known value and then check the consequences. Examples
in form_attr_dialog_popup
doubleclick formHorizSpacingField
type 100
in coreDialog
multiclick title_t
type My Dialog Title
Notes
There is a limit of 512 characters to the length of a line which can be handled by WorkShop Visual Replay. In you want to enter a text string whose length exceeds this limit, split the text and type in each section.
C.8 Button Actions (Position Dependent Controls)
Keywords
push
-
press and release a mouse button
drag
-
combine a press and release within the same widget
Synopsis
push widget(mame,qual)
drag widget(name1,qual1)-widget(name2,qual2)
Inputs
widget
a widget name
name, name1, name2
application/widget dependent description
qual, qual1,qual2
a qualification of the description
Description
In some widgets (e.g. drawing areas) where you click is important. In the case of drawing areas, a position within the drawing area is needed. For lists, you need an indication of which item has been selected. The version of push listed above is intended for such position-dependent widgets. Example
The first example shows how the Motif DrawingArea widget has been implemented for WorkShop Visual testing:in ApplicationShell
push tree_da(mybutton,centre)
In the next example we show how attachments are made between the frame1 and button_box widgets in the WorkShop Visual form layout editor:in form_layout
drag layout(frame1,right)-layout(button_box,left)
You can try out these effects in WorkShop Visual. Notes
Information on how to handle your own position-dependent widgets, or those from a 3rd party supplier, are given in the Extending the WorkShop Visual Replay Widget Set section on page 451.
C.9 Resource Evaluation
Keywords
printres - print the value of a widget resource Synopsis
printres widget->resource
Inputs
widget
the name of a widget
resource
the name of the widget resource
Description
printres prints the current value of a specified resource within a selected widget. This is especially useful in test scripts where a known resource value is expected. The name of the resource must be specified without any "XmN" prefix, e.g. "labelString". Example
in my_shell
if !my_option_menu->menuHistory:default_option
message FAIL: bad setting for my_option_menu
message Setting should be:
printres my_option_menu->menuHistory:default_option
endif
C.10 Widget Hierarchy Analysis
Keywords
Synopsis
tree widget
dump widget
snapshot widget
Inputs
widget
the name of a widget
Description
The tree, dump and snapshot commands allow you to analyze the structure of the widgets within an application interface and the values of resources assigned to those widgets. The results from the analysis are displayed on standard error. Example
The following command displays the resources allocated to the button1 widget:in ApplicationShell
dump button1
Part of the example output is shown below:button1():
Boolean ancestorSensitive:true
HorizontalDimension width:58
VerticalDimension height:22
Pixel background:color('black')
Pixel foreground:color('#72729F9FFFFF')
HorizontalDimension highlightThickness:1
Pixel highlightColor:color('black')
XmString labelString:'Button A'
Pixel armColor:color('red')
The next command displays the widget hierarchy from the form1 widget:in ApplicationShell
tree form1
Part of the example output is shown below: rowcol1():
buttonA():
button2():
address_area():
label1():
text1():
Notes
WorkShop Visual Replay assigns a unique name to widgets which share a common widget name within a shell (e.g., HorScrollBar#1, HorScrollBar#2, Apply#3, Apply#5, etc.). Where the replay name is different from the actual widget name, it is given within the brackets.
C.11 Non-application operations
Keywords
Synopsis
delay duration
message text
sequence text
shell command
setenv env-var env-value
breakpoint widget
exit status
Inputs
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.
A script which contains the breakpoint keyword should be invoked as follows:
visu_replay -f script debugger appwhere 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.
in ApplicationShell
push mywidget
delay 5
push yourwidgetTo take a screen dump of a shell without window manager decorations:
in ApplicationShell
setenv ID WindowId(ApplicationShell)
shell xwd -id $ID -out /tmp/shell.xwdTo take a screen dump with window manager decorations:
in ApplicationShell
setenv ID WindowFrame(ApplicationShell)
shell xwd -id $ID -out /tmp/shell.xwdTo 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
To do the same with an OptionMenu:
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.
in ApplicationShell
push option_menu.OptionButton
setenv ID WindowId(option_menu->subMenuId)
shell xwd -id $ID -out /tmp/shell.xwdTo note the background color of the cascade button's parent:
in ApplicationShell
setenv ID Parent(cascade_button)->background
shell echo The Color $ID
if
else
elif
endif
if expression
actions
[elif expression
actions]
[else
actions]
endif
expression
|
an expression which evaluates to true or false
|
actions
|
one or more user actions
|
in my_shell
if !my_option_menu->menuHistory:default_option
message FAIL: bad setting for my_option_menu
message Setting should be:
printres my_option_menu->menuHistory:default_option
else
message setting ok for my_option_menu
endif
IsPseudoColor
IsDirectColor
IsTrueColor
IsStaticColor
IsStaticGrey
IsGreyScale
if expression
actions
endif
expression
|
one of the keywords listed above
|
if !IsPseudoColor
message Non PseudoColor display
in warning_popup
push warning.OK
endif
IsVisible
IsManaged
IsRealized
IsHere
if expression
actions
endif
expression
|
one of the keywords listed above
|
IsVisible is intended for small (VGA) displays where the whole of a dialog may not be visible on the screen. This is important as Motif TAB navigation traversal model ignores controls which are off screen.
IsHere simply checks whether the widget exists in the current shell.
in ApplicationShell
cascade file_menu
select fm_menu.fm_exit
if IsVisible(save_dialog)
in save_dialog
push save.ok
else
message Save Dialog cannot be seen
endif
import
|
-
|
load a module of additional commands
|
user
|
-
|
invoke a command from a loaded module
|
import module
user command text
module
|
the name of the module
|
command
|
the name of the command
|
text
|
parameters passed to the command
|
import mymodule
in ApplicationShell
cascade file_menu
select fm_print
in print_dialog
user myscreendumper print_dialog
C.16 WorkShop Visual Replay Widget Naming Conventions
In WorkShop Visual Replay, the widget name is what you use to reference a widget. One of the main tasks for any widget-based testing tool is identifying the right widget. The naming convention must be unambiguous, without being over-complicated.
in ApplicationShell
push mywidget
in ApplicationShell
push myradiobox.mytogglebuttongadget
in ApplicationShell
push myradiobox.unnamed
in ApplicationShell
push mywidget#17
push myradiobox.unnamed#3
push myradiobox#2.unnamed#2
Note - the instance numbers are automatically calculated when you record a script. Instance #3 simply means the third occurrence of that name in a depth-first left to right search of the widget hierarchy for that shell.