## 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.

Here are the rules used by WorkShop Visual Replay:

1. If the control is a widget (i.e. not a gadget), and it is the only widget with that name in the current dialog, use the widget name, e.g.

           in ApplicationShell
       	push mywidget

2. If the control is a gadget, use parentname.gadgetname

           in ApplicationShell
       	push myradiobox.mytogglebuttongadget

3. Where a widget name is null (i.e. ""), use unnamed, e.g.

           in ApplicationShell
       	push myradiobox.unnamed

4. Where there are multiple instances of this widget name (or gadget name) in the current shell, then reference the instance by number, e.g.

           in ApplicationShell
       	push mywidget#17
       	push myradiobox.unnamed#3
       	push myradiobox#2.unnamed#2

5. If you are writing your script by hand, the tree(2) can be used to examine the widget hierarchy:

           in ApplicationShell
       	tree ApplicationShell

   This outputs a recursive listing of the widget hierarchy. The listing contains the actual widget name, and in parenthesis, the name you should use for WorkShop Visual Replay, if it is different from the actual name.

6. If the shell name is ambiguous, then use instances, e.g.

           in myshell#2
       	push button1

           in myshell#3
       	push button2

Note - the instance numbers are automatically calculated when you record a script. Instance #3 simply means the third occurrence of that name in a depthfirst left to right search of the widget hierarchy for that shell.

See also:

- WorkShop Visual Replay Overview