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:
- Open your application and the application"s test frame file.
- Place the insertion point on the declaration for the application"s main window.
- Select Record/Method. SilkTest displays the Record Method dialog, which allows you to record a method for a class or window declaration.
- Select BaseState from the drop-down list in the Method Name field.
- 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.
- 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.
- 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.
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.