Commands marked recordable are the commands that can be automatically generated by the TestSmith recorder, available on the TestSmith GUI, if required. It is suggested that the recorder only be used as a kick-start for creating a script. Fine-tuning is always recommended.



Window (wnd) Commands  ^

Name Description Default Params Extra Params
wndInit
recordable
Register the main frame window object of a particular window (identified by the wtitle and wclass parameters) as a TestSmith window with the specified id. All subsequent commands with the same id will interact with this window. Multiple windows can be included in a single test script, providing each has a unique id.
Note: if the id parameter is omitted from any subsequent command the last valid id that was referenced will be used for that command.
id
wtitle
wclass
wrect
wtitle~
wclass~
zsync
zinterval
ztries
wndSetFocus Bring the specified window into focus independently of any particular action on that window. Most commands will automatically put the focus on the specified window, so this command is really only needed as an extra precaution, or if you notice that a window is not gaining the focus prior to a particular command.
If taking advantage of the persistent id feature use this command to reset the persistent id, i.e. to switch between windows.
id
zsync
zinterval
ztries
wndMove
recordable
Move or resize a window.
Note: when recording a script this command is automatically created whenever a window is moved or resized since the last action on that window. However, window position is not usually important as mouse actions are fired relative to the window, not the desktop, so these commands can usually be safely commented out or removed from the script.
id
wrect
zsync
zinterval
ztries
wndClose
recordable
Close the specified window and release the window id.
Note: certain window types, such as dialog windows, are usually closed in response to a mouse or key command. In such cases a wndRelease command should be used in place of a wndClose command.
id
zsync
zinterval
ztries
wndRelease Release the window id so it can be re-used later in the same script.
This command should be used instead of wndClose if the window is being closed with a mouse click on a button (or a equivalent key stroke) as is usually the case for dialog windows - especially popup dialogs.
id
zsync
zinterval
ztries
wndFindObj Find a window object that belongs to the parent window specified by the id parameter.
This command (which has no action associated with it) is useful for synchronizing on a window object, to ensure that an application is fully loaded before moving on to performing actions on the object or on some other object within the parent window.
Note: this command can be created by recording a mouse action on the object of interest and then renaming the command and removing the unnecessary parameters.
id
wnum
wtitle
wclass
wcid
wpclass
wwidth
wheight
zsync
zinterval
ztries

Mouse (ms) Commands  ^

Name Description Default Params Extra Params
msLClick
recordable
Left button click on the specified window object. The wx and wy parameters are optional. If they are not used the window object is clicked at its center.
Note: the recording of this command only occurs when the mouse 'up' action is within 8 pixels of the mouse 'down' action. In all other cases a msLDrag command will be recorded.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
kstate
mtime
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msLDrag
recordable
Left button drag across the specified window object.
Note: this is recorded instead of a msLClick command when the mouse down/up actions occur more than 8 pixels apart.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
wxx
wyy
kstate
mtime
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msLDragDrop
recordable
The dragging and dropping of a file, link, text selection, etc. from the specified window object to another destination, determined by the wxx and wyy parameters relative to the starting window object.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
wxx
wyy
kstate
mtime
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msL2Click
recordable
Left button double click on the specified window object.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
kstate
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msRClick
recordable
Right button click on the specified window object. The wx and wy parameters are optional. If they are not used the window object is right-clicked at its center.
Note: the recording of this command only occurs when the mouse 'up' action is within 8 pixels of the mouse 'down' action. In all other cases a msRDrag command will be recorded.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
kstate
mtime
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msRDrag
recordable
Right button drag across the specified window object.
Note: this is recorded instead of a msRClick command when the mouse down/up actions occur more than 8 pixels apart.
id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
wxx
wyy
kstate
mtime
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msR2Click
recordable
Right button double click on the specified window object. This is a rarely used action that usually adds nothing to a single right mouse click. id
wnum
wtitle
wclass
wcid
wpclass
wx
wy
kstate
wtitle~
wclass~
wpclass~
wptitle
wptitle~
wwidth
wheight
zsync
zinterval
ztries
adjust
grabfocus
msHover
recordable
A mouse-over action on a window object, that triggers a particular response, for example, the expansion of a menu in an html page.
Note: to record this command please follow these steps:
  • Move the mouse pointer over the required 'hot spot'
  • Hold down the Ctrl and Shift keys
  • Click the Left mouse button
  • Hold down the button for as long as the hover should be
  • Release the button
  • Release the Ctrl and Shift keys
  • id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wx
    wy
    mtime
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    wwidth
    wheight
    zsync
    zinterval
    ztries
    adjust
    grabfocus
    Mouse-based Scrolling
    msScroll
    recordable
    Drag a scroll bar (in any direction). This command is a simple name wrapper around a msLDrag command.
    Note: during a recording not all window types will generate a msScroll command, but the corresponding msLDrag can be renamed accordingly. This is useful to identify what the command does in the script.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wx
    wy
    kstate
    mtime
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    wwidth
    wheight
    zsync
    zinterval
    ztries
    adjust
    grabfocus
    Mouse-based Menu Interaction
    msMenuSelect
    recordable
    Selection of menu or menu item with the mouse.
    Note: the msMenu commands are recorded when the mouse interacts with a menu. It is recommended that the whole group of msMenu commands be replaced by a kbMenuSelect command for more accurate playback. If creating a script manually use only the kbMenuSelect command to interact with a menu.
    id
    wtitle
    wx
    wy
     
    msMenuHilite
    recordable
    Highlight of menu item that has a sub-menu associated with it.
    Note: the msMenu commands are recorded when the mouse interacts with a menu. It is recommended that the whole group of msMenu commands be replaced by a kbMenuSelect command for more accurate playback. If creating a script manually use only the kbMenuSelect command to interact with a menu.
    id
    wtitle
    wx
    wy
     

    Keyboard (kb) Commands  ^

    Name Description Default Params Extra Params
    kbKey
    recordable
    A key press on a system key, such as F1, Home, End, Page Up, etc. or a system key combination such as Ctrl+C, Ctrl+P, Alt+LeftArrow, etc. id
    kkey
    kstate
    krep
    grabfocus
    kbText
    recordable
    Type text into a window.
    Note: when recording, the text is buffered until a TAB or ENTER key is typed, then this command is created along with a kbKey command for the TAB or ENTER key.
    id
    ktext
    kkeybd
    grabfocus
    Keyboard-based Menu Interaction
    kbMenuSelect Selection of a menu item. A menu item can be selected through keyboard interaction by using either mnemonics (menuitem parameter) or navigation keys (menugo parameter).

    Examples:
       kbMenuSelect id=1 menuitem=E/P ;
    This command would select the Edit/Paste item on the Notepad menu.
       kbMenuSelect id=1 menugo=R/D/D/D/D ;
    This command would do the same, using the arrow keys (right/down) to navigate the menu.
    The advantage of the mnemonics approach is that a menu item can move position between tests and it will still be correctly located. Two separator characters are valid for use, '/' or '~', but are optional, thus the following strings are all equal R/D/D/DR~D~D~DRDDD.

    Note 1: to interact with the Windows 'Start' menu the wtitle parameter must be used and set to exactly wtitle=Desktop_Taskbar. See How do I record actions on the Windows "Start" menu? in the User Guide FAQ for more information.

    Note 2: the menuitem parameter supports the special characters  '<', '>', '{' and '}'  to navigate to sub menus of the Windows 'Start' menu.

    Note 3: the mtime parameter can be used to pause between each menu item selection. This allows a clear view of which items on the menu are being selected and is useful for debugging.

    Note 4: if you have recorded a script with menu interaction use a single kbMenuSelect command to replace any set of msMenuSelect and msMenuHilite commands. This will simplify the script and provide a more accurate and adaptable playback.
    id
    menuitem or
    menugo
    wtitle
    mtime

    Control Object (ctrl) Commands  ^

    Name Description Default Params Extra Params
    ctrlButtonClick
    recordable
    A (left-button) click on a Windows 'Button' object.
    The wtitle of a Button object is the label on the button.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    ctrlStaticClick
    recordable
    A (left-button) click on a Windows 'Static' object.
    The wtitle of a Static object is the visible text (if any) of the item.
    Static objects are usually non-responsive, so it is rare to click one for any reason other than to validate its text (i.e. the wtitle value).
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    ctrlButtonCheck
    recordable
    Set (or unset) a Windows 'CheckBox Button' object.
    The wtitle of a CheckBox Button is the label of the checkbox.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    ccheck
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    ctrlEditSetText
    recordable
    Set the text value of a Windows 'Edit' box. The supported classes for this action are limited to:
  • Edit - the standard Edit control (also used in Notepad)
  • RICHEDIT - the standard Rich Edit control
  • RichEdit20W - the control used for WordPad
  • id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    ctext
    cedit
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    ctrlListSetItem Set a single item or multiple items in a ListBox, or a single item in a ComboBox. The item or items can be set either by value (using the citem parameter) or by index (using the cindex parameter).
    • citem: for single selections a single text string should be provided; for multiple selections in a multi-select ListBox the value can be a comma separated list of strings.
    • cindex: for single selections a single numeric value should be provided; for multiple selections in a multi-select ListBox the value can be a comma separated list of numeric values.
    If both citem and cindex are used the cindx value will prioritize and the citem parameter will be ignored.
    By default the item selected using the citem parameter will be the first one that starts with the citem value (case insensitive). If an exact match is required use the cexact parameter as cexact=1.
    For multi-select ListBoxes the previous selections will not be cleared unless the cclear parameter is set as cclear=1.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    citem or
    cindex
    cclear
    cexact
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    valEditText see Validation Commands.
    valListItem see Validation Commands.

    HTML Document (html) Commands  ^

    TestSmith html and valHtml commands are valid only for interaction with IE browser components, either in the IE Browser itself, or in applications that embed this component.
    Name Description Default Params Extra Params
    htmlLink
    recordable
    A (left-button) click on an HTML A (anchor) or AREA element in a IE-style window. id
    wnum
    hframe
    hidx
    htag
    hid
    hvistext
    hhref
    zsync
    hhref~
    hvistext~
    hfailtext~
    hfailtext
    hparentid
    hrange
    hevent
    halign
    zinterval
    ztries
    ...variables
    htmlSelect
    recordable
    A (left-button) click on an HTML INPUT element in a IE-style window where type = TEXT, TEXTAREA, PASSWORD or FILE. id
    wnum
    hframe
    hidx
    htag
    hid
    htype
    hname
    hvalue
    hvistext
    zsync
    hname~
    hvalue~
    hvistext~
    hfailtext~
    hfailtext
    hparentid
    hrange
    hevent
    halign
    zinterval
    ztries
    ...variables
    htmlCheck
    recordable
    Set (or unset) an HTML INPUT element in a IE-style window where type = RADIO or CHECKBOX . id
    wnum
    hframe
    hidx
    htag
    hid
    htype
    hname
    hvalue
    hvistext
    hchecked
    zsync
    hname~
    hvalue~
    hvistext~
    hfailtext~
    hfailtext
    hparentid
    hrange
    hevent
    halign
    zinterval
    ztries
    ...variables
    htmlInput
    recordable
    A (left-button) click on an HTML INPUT element in a IE-style window where htmlSelect and htmlCheck do not apply, for example, all buttons and input images.
    Note: during a recording, if the INPUT element is of type=FILE and the "Browse..." button, rather than the input text field, is clicked this action will be recorded as a htmlClick command. The same ruling should be applied for a manually created script.
    id
    wnum
    hframe
    hidx
    htag
    hid
    htype
    hname
    hvalue
    hvistext
    zsync
    hname~
    hvalue~
    hvistext~
    hfailtext~
    hfailtext
    hparentid
    hrange
    hevent
    halign
    zinterval
    ztries
    ...variables
    htmlChoice
    recordable
    Command for interacting with <SELECT> elements. Options in a list can be selected by position (hoption/hoptions) or by value (hoptval/hoptvals).

    Single-select objects:
    Only one of hoption and hoptval should be used. If both are used hoption will take priority.

    Multiple-select objects:
    Only one of hoptions and hoptvals should be used. If both are used hoptions will take priority.
    hoptions=0 must be used to deselect all options.
    Note: when recording, this command is recorded without the appropriate option values, which need to be edited in manually during or after the recording.
    id
    wnum
    hframe
    hidx
    htag
    hid
    htype
    hname
    hvistext
    select-one:
    hoption
    hoptval
    select-mult:
    hoptions
    hoptvals
    hvistext~
    hfailtext~
    hfailtext
    hhtml
    hparentid
    hrange
    hevent
    hoptkey
    zsync
    zinterval
    ztries
    ...variables
    htmlClick
    recordable
    A (left-button) click on all other HTML elements in a IE-style window where htmlLink, htmlSelect, htmlCheck, htmlInput and htmlChoice do not apply. id
    wnum
    hframe
    hidx
    htag
    hid
    hvistext
    zsync
    hvistext~
    hfailtext~
    hfailtext
    hparentid
    hrange
    hevent
    halign
    zinterval
    ztries
    ...variables
    htmlText
    recordable
    A text entry into an HTML INPUT element.
    The text specified by hvalue will be inserted into the HTML element via the Document Object. To override this behavior the ktext parameter can be used instead of hvalue to enter the text in a more traditional way.
    (If both parameters are used ktext will prioritize but hvalue will be used to validate the previous text in the element, prior to entering new text.)

    Text Entry into an HTML input field will occasionally be recorded as a kbText action. See Known Quirks & Limitations.
    id
    wnum
    hidx
    hframe
    htag
    hid
    htype
    hname
    hvalue
    zsync
    hvalue~
    hparentid
    hrange
    ktext
    kkeybd
    zinterval
    ztries
    htmlNavigate Navigate to the specified URL in the Window identified by id and the I.E. browser object specified by wnum. (If there is only one I.E. browser object in the Window the wnum parameter can be omitted.)
    Note: if the script was recorded you should use this command to replace the set of commands that were recorded for typing a new URL in the address box of an IE Browser and hitting the Enter key. It is simpler, and has greater accuracy.
    id
    wnum
    url
     
    htmlWriteMsg Set a message in an IE browser window. This is a non-functional command. It is useful for announcing that a test or section of a test in a particular IE browser window is complete. The hhtml parameter can specify any text or formatted html. If no specific html is provided, by default the given text will be formatted as 12pt sans-serif and aligned center. This can be overridden by providing html tags in the message, e.g.
    hhtml='</center><font style="font-family:serif; font-size:18pt"><b>My Message Here</b></font>
    This code will create a message in 18pt serif, aligned to the left.
    id
    wnum
    hhtml
     
    htmlSaveImg Save a .gif, .jpeg or other supported image to the local drive. The image at the given hidx, or matching the given hhtml will be saved with the given name. Any existing file with the same name will be overwritten. The saved file can then be compared to an existing file, or used in the same way any other local file can be used.
    If the filename is invalid or the path cannot be found the file will not be saved and an error message will be generated.
    Note: if you are recording a script a simple way to create an htmlSaveImg command is to record a valHtmlElem command on an IMG element, then rename the command to htmlSaveImg and add the file parameter - which must be a full path name.
    id
    wnum
    htag
    hidx
    hframe
    hhtml
    hhtmltype
    file
    hhtml~
    hvistext~
    hfailtext~
    hfailtext
    hrange
    zsync
    zinterval
    ztries
    valHtmlElem see Validation Commands.
    valHtmlText see Validation Commands.
    valHtmlTitle see Validation Commands.
    valHtmlUrl see Validation Commands.

    Validation (val) Commands  ^

    Name Description Default Params Extra Params
    valHtmlElem
    recordable
    Validation of an HTML element. Refer to hhtml and hhtmltype for information on the types of html that can be validated for an element.
    Note 1: recording of valHtmlElem is initialized by right-clicking on an HTML element while holding down the Ctrl key (for the active element) or the Alt key (for the innermost element). A prompt will appear with the details of the element and a "Validate..." button. Click the button to record the command. If any text is selected on the page during this operation the valHtmlText command will be recorded instead.
    id
    wnum
    htag
    hidx
    hframe
    hhtml
    hhtmltype
    hvistext
    hhtml~
    hvistext~
    hfailtext~
    hfailtext
    hrange
    zsync
    zinterval
    ztries
    ...variables
    valHtmlText
    recordable
    Validation of HTML visible text.
    Note 1: recording of selected text is initialized by right-clicking, as described above for the valHtmlElem command.
    id
    wnum
    hidx
    hoffset
    htag
    hframe
    hvistext
    hvistext~
    hfailtext~
    hfailtext
    hrange
    zsync
    zinterval
    ztries
    ...variables
    valHtmlTitle Validation of the HTML page title from the <TITLE> tag.
    Note: this value may not match the title displayed in the IE browser's title bar.
    id
    wnum
    htitle
    htitle~
    zsync
    zinterval
    ztries
    ...variables
    valHtmlUrl Validation of the HTML page url as expressed in the DOM.
    Note: this value may not match the url displayed in the IE browser's address field.
    id
    wnum
    url
    url~
    zsync
    zinterval
    ztries
    ...variables
    valClipText
    recordable
    Validation of a line or block of text.
    Note: this command usually requires recording. The required text should be selected using the normal method of text selection, then the Record->Select Validation Text menu item should be used to trigger the creation of the command. On playback a mouse-drag is executed at the given coordinates to select the text and the selected text is compared to the specified text.

    The message dialog that appears after the text has been selected is a necessary nuisance. See Known Quirks & Limitations.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wx
    wy
    wxx
    wyy
    mtime
    vtext
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    vtext~
    zsync
    zinterval
    ztries
    ...variables
    valWindowText Validation of all text in the specified window, or in the child window that has the mouse/keyboard focus. This command only works on certain window types, as specified here:
  • Standard Windows Dialog boxes
  • Child windows where the entire text can be selected with a Ctrl+A key action.
    The text in the window is compared with the vtext (or vtext~) value.
    This command is useful to validate text in javascript popups, or other alert-type dialog boxes. It is also the only way to validate visible text in html frame windows which contain html served by an outside domain from the parent frame.
  • id
    vtext
    vtext~
    valEditText
    recordable
    Validation of the text in an Edit control.
    Note: during a recording this validation is initialized by using a Ctrl+LeftClick action on the Edit control. Unlike the valClipText command, this does not require any text selection.
    Additional, non-standard Editable controls are also supported for this command. The list of classes representing Edit controls is taken from the Editable Class Names setting in Record Options. This setting can be customized as required; the classes supported by default are:
  • Edit - the standard Windows Edit control (also used in Notepad)
  • RICHEDIT - the standard Windows Rich Edit control
  • id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    vtext
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    vtext~
    zsync
    zinterval
    ztries
    ...variables
    valListItem Validation of the text in a ListBox or ComboBox control.
    Only single list items can be validated with this command. If the cindex parameter is used the vitem value will be compared only with the item at the specified index, otherwise it will be compared with all items in the list. The match is case sensitive and must be exact in order for the validation to pass.
    id
    wnum
    wtitle
    wclass
    wcid
    wpclass
    cindex
    vitem
    wtitle~
    wclass~
    wpclass~
    wptitle
    wptitle~
    zsync
    zinterval
    ztries
    ...variables
    valBitmap
    recordable
    Validation of a rectangular section (bitmap) of a window.
    Note: this command must be recorded. A hash is calculated on the pixels of the bitmap during recording. The same hash is calculated on playback and the two are compared.
    If the bitmap is contained within a single child window the identifying parameters of that child window (i.e. wnum, wtitle, wclass, wcid and wpclass) are included in the command, and the vrect is relative to that child window. Otherwise the vrect is relative to the top-level (frame) window.
    Inexact matching is achieved by setting the vpixelhash parameter to a pipe-separated (|) list of pixel hashes. Matching on any one of these hashes signifies success.
    Recording of valBitmap is initialized by selecting the Select Validation Bitmap menu item from the Record menu.
    id
    vpixelhash
    vrect
    child wnds:
    wnum
    wtitle
    wclass
    wcid
    wpclass
    wwidth
    wheight
    wptitle
    zsync
    zinterval
    ztries
    voutline
    valSeekItem
    recordable
    Validation of an item, such as a button, menu item, bitmap or other small screen area.
    Note: this command must be recorded. The recorded item is identified by a pixel hash, in the same way that a bitmap is identified. On Playback, if the item is not where it was when the recording was made the item is searched for along the vertical and/or horizontal planes of the active window. This command is especially useful for sending clicks to 'buttons' on browser-style toolbars that often move and cannot be identified as unique window objects, due to the way such toolbars are rendered (the buttons are 'painted' on to the toolbar, they are not window button objects).
    Recording of valSeekItem is initialized by positioning the mouse over the point to be sought and then hitting one of the pre-defined hot keys. Unless the item is the title bar or a menu item the window object parameters (i.e. wnum, wtitle, wclass, wcid and wpclass) are included in the recorded command.
    Refer to Recording a valSeekItem Command for a full description of how to record this command.
    See the Seek Item documentation for more information on this topic.
    See also the adjust parameter which can be used on subsequent mouse clicks to adjust them to the new position of the sought item.
    id
    vpixelhash
    vseektype
    wx
    wy
    vaxis
    usually:
    wnum
    wtitle
    wclass
    wcid
    wpclass
    vsquare
    vsilent
    vxinc
    vyinc
    vvariation
    vmenufixed
    voutside
    wwidth
    wheight
    wptitle
    zsync
    zinterval
    ztries

    File (f) Commands  ^

    File commands are independent of any Window so do not require an id parameter. File commands are intended for text files only; using these commands on binary files will result in unpredictable behavior.
    File commands are only available for Smith scripts. File manipulation in other supported languages should be done using that language's own libraries.
    Name Description Params
    fRead Read the contents of a file into the ftext parameter. The ftext parameter must be set to either ftext=:, ftext=+ or ftext=@. These special values are explained in the TestSmith Variables section of the User Guide. file
    ftext
    fWrite Write data to a file. This command will overwrite any data that already exists. If the file does not exist it will be created. file
    ftext
    fAppend Write (append) data to a file. This command will append its data to any data that already exists. If the file does not exist it will be created. file
    ftext
    fCopy Copy an existing file to a new file. If the file to be created already exists it will be overwritten with the new data. file
    file2
    fMove Move an existing file. Effectively renames the file with a new full path name. If the file to be moved to already exists it will be overwritten with the new data. file
    file2
    fCompare Compare two files and output an INFO message with the result of the comparison. Providing both files are found and are readable this command will always return an OK result. If any difference is considered to be an error the fmatch parameter must be set to 1 in order to force an ERR result when the files are different.
    Note: binary file comparison is only supported in v1.3 and above of TestSmith.
    file
    file2
    fmatch
    fExist Test if the given file exists. Returns an ERR result if the file is not found. file
    fdExist Test if the given directory exists. Returns an ERR result if the directory is not found.
    file

    Registry (reg) Commands  ^

    Registry commands are independent of any Window so do not require an id parameter.

    Disclaimer: Quality Forge does not endorse the writing of data to the Windows Registry, and takes no responsibility for the outcome of such action. Any use of the regWrite command is at the user's own risk.
    Name Description Params
    regRead Read the contents of a file into the rdata parameter. The rdata parameter must be set to either rdata=:, rdata=+ or rdata=@. These special values are explained in the TestSmith Variables section of the User Guide. rkey
    rvalue
    rtype
    rdata
    regWrite Write data to a registry key value. If the key does not exist an ERR is returned. If the key value does not exist it is created. rkey
    rvalue
    rdata
    rtype

    Internet (inet) Commands  ^

    Internet (inet) commands are independent of any Window so do not require an id parameter.
    Name Description Params
    inetRequest A simple HTTP request made directly to the server. The url can contain data (name=value pairs), in which case a GET request is used, so the full length of the url cannot be greater than 1024 characters. POST requests are not yet supported (watch this space).
    An inetRequest command will return an error if the url is not located, for any reason. The ERR line in the report will specify the reason and the error code returned by the call.
    Optional Validation
    The returned resource can be checked for validity using four different criteria, in the following sequence: headers, content (text/html files only), size and last modified date. If any of the specified tests do not pass, the command will return an error with an appropriate message in the ERR line of the report. Care should be taken when using these validations on dynamically generated html. Click on an individual parameter to see the formatting rules for that parameter.
    url
    iheaders
    icontent
    icontent~
    isize
    imodtime

    Other Commands  ^

    These commands are independent of any Window so do not require an id parameter.

    Commands marked smith are only available to Smith scripts.
    Name Description Params
    lock
    smith
    Explicitly lock the playback process.
    Locking is useful during a multiple-parallel playback session to ensure only the locked play thread has access to a resource.
    Note: Interactions with the Desktop, the Desktop Task bar and any menu item are implicitly locked. Other play threads will wait in the queue until the implicit unlock' is called.
     
    unlock
    smith
    Release the explicit lock.  
    system Execute a Windows System command. run
    reportTime Write an INFO line to the report stating how many milliseconds have passed since the start of the playback, or since the timer was last reset. The timer is always reset to 0 at the start of each playback and can (optionally) be reset from this command at any time. The elapsed time value can be saved in the 'elapsed' (out) parameter. reset
    elapsed
    setVar Set one or more of the TestSmith variables. Be sure to use the correct assignment operator. The values of these variables can then be tested with a _doif statement.
    Note: setVar should not be needed if using Ruby, Java or C++. Use the language's own method for setting up variables. See the appropriate API documentation for more information.
    stroffset
    strlength
    strtrim
    ...variables
    setDataIndex
    smith
    Override the default data index with a new value. By default the data from a .csv file is read a row at a time, starting at row 1 and incremented for each repeated playback. By explicitly setting the data index this default behavior can be overridden, and you can for example reference many different rows from a .csv file in a single playback by re-setting the index multiple times in one script.
    See Data Driven Tests for more information.
    value
    sendAlert Send a text alert. Alerts can be sent when an error occurs, but this command allows an alert to be sent independently of an error occurring. It is useful when you want a detailed message to be sent, rather than just the auto-generated error message. Example:
    _doif errlast=!0 ;
        sendAlert alert=yim:myname alertmsg='Something went wrong...' ;
    _endif;

    See TestSmith Alerts for more information about sending alerts.
    alert
    alertmsg
    wait
    smith
    Wait for a period of time as specified by the sleep parameter. sleep
    printOk Print an OK message to the report, independently of any command. The main use for this command is to output a success message after an action or series of actions within a Ruby, Java or C++ class that uses one of the TestSmith APIs. message
    printErr Print an ERR message to the report, independently of any command. The main use for this command is to output a failure message after an action or series of actions within a Ruby, Java or C++ class that uses one of the TestSmith APIs. message
    noop Do nothing. Use a noop command when you want to display some information in a popup dialog, or output a remark to the report without carrying out any other action. remark
    popup

    Control Statements (begin with "_")  ^

    Control flow statements only apply to Smith scripts.
    Name Description Params
    _call Load and execute the named script.
    Once the called script has completed, control returns to the next command in the calling script.
    This command allows a script to be sub-divided into logical sections, e.g. a script called main.smith may _call 5 short scripts named init.smith, login.smith, act1.smith, act2.smith, logout.smith.
    Important Note
    Newly created windows in a called script cannot use the same id parameter value that is used by a window in the calling script, unless the window previously using the id value has been closed with a wndClose command.
    script
    _goto Jump to a specified command.
    Use this command to jump backwards or forwards through a script. The _goto statement will jump to the next command in sequence that has a matching label parameter.
    Use code like the following to create a looping structure in your program:

       # start loop
       setVar counter=+1 label=LOOP1 ;
       _doif counter=<3 ;
          noop remark={counter} ;
          # other commands...
          _goto label=LOOP1 ;
       _endif ;
       # end loop

    Important Note
    A _goto statement is a powerful construct but must be used with care. If the following rules are not followed for _goto statements the outcome will be unpredictable.
  • The _goto statement must always originate inside its own _doif/_endif block.
  • It must be the last statement before the _endif statement.
  • The label it jumps to must be attached to a command outside this _doif/_endif block but NOT outside any outer _doif/_endif. Ideally, it will be the command immediately before the _doif statement, as in the above example.
  • The above example is the recommended way to create a looping structure.
    The counter parameter should be used in conjunction with a _goto statement. counter can be set and tested in the same way as other variables, except that it can only be set explicitly. See counter for more information.
  • label
    _doif Test a condition, to determine if a command or set of commands should be executed.
    If the condition evaluates 'true' all the commands up until the next _endif statement will be executed. If it evaluates 'false' these commands will be skipped and execution will continue at the next command following the _endif statement.
    _doif/_endif blocks can be nested, up to any depth. See the guide to TestSmith variables for more information on testing the value of a variable.
    errlast
    errworst
    op
    ...variables
    _endif Ends a _doif block.  
    _pause Pause the playback. Playback can be resumed from the TestSmith Play/Resume menu item, or by pressing Ctrl+Alt+F8.
    Note 1: This command has a global effect: if multiple scripts are running in parallel all scripts will be paused.
    If you want to pause a single script use a noop command with an appropriate sleep value.
    Note 2: _pause statements are ignored completely when the script is being played back using the PlaySmith application.
     
    _break Force control to jump to the end of the script. If the script is running once only (REPEAT=1) this is effectively the same as _exit.  
    _exitsub Exit the current sub-script. Control returns to the next command in the calling script.  
    _exit Exit the script completely.  

    Environment SET Command  ^

    SET, as it's name implies, sets the environment for the TestSmith script to operate in. This may include launching applications, opening a data file for data substitutions or setting the root directory.  The SET command can be called multiple times, but never with the same directive more than once in a single call.  If more than one application is to be launched SET would have to be called twice, once for each LAUNCH. If one LAUNCH and one DATA directive were being used a single call would suffice.

    Note 1
    SET commands can only be defined in the main, calling script (i.e. the script being run) or in a sub-script named with the "SET_" prefix (e.g. SET_VariableNames.smith, SET_CSVData.smith.).  Any SET command in any other sub-script will be ignored.

    Note 2
    The SET command is only really useful for .smith scripts. When using Ruby, Java or C++ as the scripting language you should make use of that language's features to carry out similar processing.
    Directive Description
    LAUNCH The name of the executable program to be launched prior to the playback commencing. This can be a full path name or a name relative to the Windows PATH environment variable.
    ROOTDIR The directory to use as the root when relative path names are given for DATA or for the script parameter of the _call control statement. The default ROOTDIR is always the directory containing the TestSmith executable (testsmith.exe file). The default will be used until ROOTDIR is set (or reset).
    DATA The full or relative path name of the *.csv file to be read for string substitution.
    See Data Driven Tests for further reference.
    REPEAT Specify the number of times this script should be played.
    Acceptable values: a number greater than zero or the constant FOREVER.  If REPEAT=FOREVER the script will continue playing until stopped either manually or by an _exit command. If this directive is not set, or the value is less than 1, the script will be played once.
    Sections of a script, or even a whole script, can be also repeated by using a _goto statement to create a looping construct.
    DECLARE_INT Declare the names of the int variables to be used in the script. The format for this directive is:
    DECLARE_INT='[name1][name2][...]'
    Each int variable will be defaulted to 0 (zero). The const keyword can be used to force the first value assigned to the variable to be unchangeable. Refer to the TestSmith Variables page of the User Guide for detailed information on setting and using variables.
    DECLARE_STR Declare the names of the string variables to be used in the script. The format for this directive is:
    DECLARE_STR='[name1][name2][...]'
    Each string variable will be defaulted to an empty string. The const keyword can be used to force the first value assigned to the variable to be unchangeable. Refer to the TestSmith Variables page of the User Guide for detailed information on setting and using variables.
    DECLARE
    deprecated
    This directive has been deprecated in favour of DECLARE_STR and DECLARE_INT.
    Declare the names of the variables to be used in the script. The format for this directive is:
    DECLARE='[name1][name2][...]'
    Refer to the TestSmith Variables page of the User Guide for detailed information on setting and using variables.
    ALERT Global setting for a TestSmith Alert. This directive takes exactly the same values as the alert parameter. The alert type defined here will apply to any command that results in an error, unless overridden by an individual command's alert parameter.
    LOGLEVEL Specify the logging level for this script. The level set here will always override the Logging Options set in Playback Options Dialog, providing it is 0 or above; any negative number will be ignored and the pre-set Logging Options will be used.
    Details:
    Each log type has a 'power of 2' number associated with it. To specify a single logging type, enter its number from the table below, e.g. 2 for Errors. To specify multiple logging types simply add the numbers together and enter the sum, e.g. 6 for Errors and Flags, 127 for everything.

       0. No Log (i.e. Start and End lines only)
       Command Results
       1.  OK
       2.  ERR
       Inter-command Messages
       4.  Flags (FLG) - something is different
       8.  Warnings (WRN) - something is different and may cause problems later in the script
       16. Extra Information (INF) - more verbose output, delays, retry-waits, etc.
       32. User defined 'remarks' (REM)
       64. Command descriptions, entered prior to the command commencing.
    ERRJOIN Specify that error codes from each command (if issued) are to be 'joined' to produce a final error code that is recorded at the end of the script run (and returned to the calling process when TestSmith exits, usually applicable only in Batch Mode.
    The two allowable values for this directive are SUM and OR.
    SUM will add all error codes together to produce the final error code.
    OR will use the bitwise logical OR operation to join the results. It is the script creator's responsibility to ensure that all return codes are ^2 values (0, 1, 2, 4, 8, etc.).
    See Error Code Params for information on how to set error levels.
    LO
    removed
    Not available in v1.2.0 and later.
    Use setDataIndex to determine/restrict which lines of a .csv file to read.
    HI
    removed
    Not available in v1.2.0 and later.
    Use setDataIndex to determine/restrict which lines of a .csv file to read.