Tips and Tricks  [updated: 16 June 2005]

Some useful tips and tricks to make your TestSmith experience easier.
  1. Stopping or Pausing a Playback

  2. Printing .smith Scripts

  3. Using a Text Editor

  4. Encode Text Strings

  5. Translate Encoded Text

  6. Create Obfuscated value

  7. Breaking a Long Parameter Value String

  8. Comment/Uncomment Blocks of Text in a Script File

  9. Context-Sensitive Help for all Script Commands and Parameters

  10. Creating commands from GUI and HTML/DOM Maps

  11. Accessing IE Internet Options Dialog

  12. Mixing Quoted and Unquoted Strings

  13. Add or Remove Specific Window Types from Recording

  14. Script Debugging Tools

  15. The Best Way to Run Scripts

  16. Creating successful Web Application tests

  17. Converting .smith scripts to Java or C++

  1. Stopping or Pausing a Playback
    Playback can be stopped or paused at any time by hitting certain hot key combinations. These hot key combinations will work regardless of which window is in focus at the time, and even if the TestSmith window is minimized or invisible.
    Ctrl + Alt + F10 to stop a playback. If multiple scripts are being run in parallel, all will be stopped.
    Ctrl + Alt + F8 to toggle between Pause and Resume of a script. If multiple scripts are being run in parallel, all will be paused/resumed.

  2. Printing .smith Scripts
    TestSmith printing of .smith scripts is doen through a text editor. Open the Print Setup dialog from the Script/Print Setup menu command. Enter the full path of the text editor you wish to use for printing .smith scripts. This editor will alo be used as the default editor as described in Using a Text Editor.

  3. Using a Text Editor
    Set up your default text editor from the Script/Print Setup menu command.
    Alt + O on the Script Window will open the script in the selected Text Editor. You can edit your script in this editor. TestSmith will prompt you to save any updates made to the script when you return to TestSmith.
    The text editor TextPad® is recommended for this purpose by Quality Forge.

  4. Encode Text Strings
    Ctrl + Shift + Right Click on selected text in the Script Window will show a tooltip-style window with the text encoded (using Smith encoding). This allows you to hand edit parameters using plain text, and then cut and paste the encoded value from the tool-tip window into the script file. If multiple lines of text are selected for encoding each encoded line will have a '+' concatenation sign appended to the end.
    See also Character Substitutions.

  5. Translate Encoded Text
    Shift + Right Click on selected text in the Script Window that contains encoded characters such as %-- will show a tooltip-style window with the text fully decoded, allowing you to read a value or a whole block of text more easily.
    See also Character Substitutions.

  6. Create Obfuscated value
    Alt + Shift + Right Click on a selected parameter value in the Script Window will obfuscate a parameter value. The obfuscated value will show in a tooltip-style window and can be copied from there and pasted into the script.
    Note: If an obfuscated value is used in a .csv data file the value must be further encoded using TestSmith encoding before being added to the .csv file. The script editor can be used to encode the value, or the encoding can be done manually by changing all occurrences of % to %pc .
    See Obfuscate Password Inputs for further information on this topic.

  7. Breaking a Long Parameter Value String
    Any string representing a parameter value can be split across multiple lines of the script file with the use of the + character. Example:
    
    
            title=My%--Application%--[A_Long_File_Name.txt]
    can also be represented as:
    
    
            title=My%--Application%-- +
    
    
                  [A_Long_File_Name.txt]
    The number of + signs used, or the number of spaces between string parts and the + signs is unimportant - they will all be stripped out and the string parts concatenated. However, it is important to remember that required spaces must always be represented as either %-- or %20. The above example could equally be represented as:
    
    
            title=My%--  +  Application%-- + +
    
    
                  + [A_Long +
    
    
                  + _File_Name. +
    
    
                  txt]
    Note: a string cannot be split in the middle of an encoded character.
    See also Mixing Quoted and Unquoted Strings.

  8. Comment/Uncomment Blocks of Text in a Script File
    Quick commenting and uncommenting of blocks of text:

    • Ctrl+B - Comment all lines in the selected block of text
    • Ctrl+U - Uncomment all (commented) lines in the selected block of text

    See Windows Help for more information on these items.

  9. Context-Sensitive Help for all Script Commands and Parameters
    Alt + Left Double Click on a command name or parameter name (or on the fuzzy character '~') in a TestSmith script will cause a jump to the appropriate help topic in the User Guide. This allows quick lookup as and when needed for all TestSmith script commands and parameters. Clicking on any other word in a script will have no effect.

  10. Creating commands from GUI and HTML/DOM Maps
    GUI and HTML/DOM Maps are textual representations of objects in a Windows hierarchy or a web page. Map items are formatted as partial TestSmith commands; they can be cut and pasted into existing scripts as required, allowing you to easily edit and add new commands to an existing script, or to create scripts from scratch without any recording.

    Commands such as ctrlListSetItem, valListItem, htmlNavigate and other non-recordable commands, can easily be created from the items in one of these maps.

    See Object Maps for more information.

  11. Accessing IE Internet Options Dialog
    Use the key combination Ctrl + Alt + I to display the IE Internet Options Dialog. This quick access to IE Options allows you to quickly clear the cache, delete cookies and configure other settings prior to recording tests in an IE Browser.

  12. Mixing Quoted and Unquoted Strings
    A script can contain both quoted and unquoted strings. The only strings that must be quoted are
    • strings that contain literal (non-substituted) spaces
    • strings that end in a new line character (%nl or %0D)
    Spaces can also be represented as %-- or %20, in which case the string need not be quoted. Thus param='some text' can also be defined as param=some%--text. The former is preferred for ease of readability.

    If a string is broken up across two or more lines (or even across the same line) using the concatenation character (+) each part of the string must be quoted or each part of the string must be unquoted. The two styles cannot be mixed, thus while:
    param='first part ' + 'second part' is acceptable, and
    param=first%--part%-- + second%--part is also acceptable,
    param='first part ' + second%--part is not acceptable.
    See also Breaking a Long Parameter Value String.

    Comma-separated lists of strings for fuzzy matching or list box selections can contain both quoted and unquoted strings in the same list, thus both the following examples are acceptable:
    param~='item 1',item2,item%--3
    param~='item 1','item2','item 3'
    Important note: ensure that there are no spaces before or after the comma separators.

  13. Add or Remove Specific Window Types from Recording
    Occasionally during a recording a specific window type such as a custom Java Swing window may not be recorded as expected. Conversely, an unwanted window, such as an IM alert window will popup and be recorded in the script. Both these cases can be dealt with by configuring the Allowed/Disallowed settings for TestSmith. These changes need to be made directly in the Windows Registry; please contact support@qualityforge for the specific steps to edit these settings.

  14. Script Debugging Tools
    Some useful script debugging tools are:
  15. The Best Way to Run Scripts
    Once a .smith script has been written and debugged using the TestSmith UI it is more effective to run the script from the commnad line, or from a batch file, using the PlaySmith program. Using PlaySmith also reduces the memory overhead.

  16. Creating successful Web Application tests
    When recording, avoid using the Tab key to move between input fields on a web form; use the mouse to click on each field that you plan to enter text into. Likewise, do not use the Enter key to submit a form; use the mouse to click on the Submit button instead. Wherever possible, a web application test should not contain any ms or kb commands, but should consist largely of html commands with some val commands (and possibly other miscellaneous commands) as appropriate.

    You can ensure correct command recording for web applications by using the Web Mode switch (available on the tool bar, and in the Record menu). When in Web Mode only html and javascript popup interactions are recorded.

    File Input elements cannot receive text input through the DOM interface. This is a DOM-imposed security restriction. To work around this problem either select the file name using the 'Browse' button or record a htmlInput command on the File Input element and then use a kbText command to enter the file name.

    See the following items for more information about web application recording:
  17. Converting .smith scripts to Java or C++
    Scripts can be recorded in Java, C++ or MFC/C++ by checking the appropriate radio button in the Advanced Recording Options. Exising .smith scripts can be converted to any of these language by using the Smith2 file conversion utility.