Can I extend SilkTest"s own DefaultBaseState?

Can I extend SilkTest"s own DefaultBaseState?

If you want the recovery system to perform additional steps after it restores the Default BaseState, you need to record a new method named BaseState and paste it into the declaration for your application"s main window. SilkTest provides the Record/Method menu command to record a BaseState method. (See Record menu.)

To record a BaseState method:

  1. Open your application and the application"s test frame file.

  2. Place the insertion point on the declaration for the application"s main window.

  3. Select Record/Method. SilkTest displays the Record Method dialog, which allows you to record a method for a class or window declaration.

  4. Select BaseState from the drop-down list in the Method Name field.

  5. Click the Start Recording pushbutton. SilkTest closes the Record Method dialog and displays the Record Status window, which indicates that you can begin recording the BaseState method. The Status field flashes the word Recording.

  6. When you have finished recording the BaseState method, click the Done pushbutton on the Record Status window. SilkTest redisplays the Record Method dialog. The Method Code field contains the 4Test code you"ve just recorded.

  7. Click OK to close the Record Method dialog and place the new BaseState method in the declaration for your main window.

When you now run a testcase which is based on the DefaultBaseState, it will perform all the actions that the DefaultBaseState always does (for a list of these actions, see below). However, after the DefaultBaseState has been restored fully, it will check the declaration for your application"s main window for the existence of a user-defined BaseState. If one exists, it will execute it before executing the testcase itself.

The DefaultBaseState

SilkTest provides a DefaultBaseState for applications, which ensures the following conditions are met before recording and executing a testcase:

  • The application is running
  • The application is not minimized
  • The application is the active application
  • No windows other than the application"s main window are open

The DefaultBaseState also ensures the following for browsers, in addition to the items listed above:

  • The browser is ready
  • Constants are set
  • The browser has toolbars, location and status bar displayed.



Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:17
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.