Recording an Application State

You can define an application state routine that Silk Test Classic runs before it executes your test case. You have to create the application state before recording the test cases that are associated with the application state. You can manually write an application state routine or you can use the Record Application State dialog box to record an application state.

To record an application state:

  1. Open the file in which you want to place the application state. This can either be the test frame file for the application or the script file where the associated test cases are defined. If you put the application state in the test frame file, it will be available to all test cases. If you put it in the script file, it will be available only to test cases in that script file.
  2. Open the application that you want to test.
  3. Click Record > Application State. If the current window is not a script or an include file, Silk Test Classic prompts you to create a new include file.
  4. Type the name of your new application state in the Application State Name text box. The application state name must be less than 64 characters.
  5. Select an application state from the Based On list box. This specifies an existing application state on which the new application state is based. By default, the last application state that you have specified in this field is selected.
  6. If you are using the Classic Agent, you can check the Show AppState status window check box to display a status window while Silk Test Classic is driving the application to the specified base state. If the status window obscures critical controls in your application, you can suppress it by un-checking this check box. By default, this check box is not checked.
  7. Click Start Recording. Silk Test Classic closes the Record Application State dialog box and displays one of the following:
    • The Record Status for the Classic Agent window, if you are using the Classic Agent.
    • The Recorder window, if you are using the Open Agent.
    The Status field flashes Recording.
  8. Drive your application to the state you want to record. At any point, you can record a verification by pressing Ctrl+Alt.
  9. When you have finished recording an application state, click Done on the Record Status window. Silk Test Classic redisplays the Record Application State dialog box. The Application State Code field contains the 4Test code that you have recorded. You can take the following actions:
    All the information in the window is complete and what you expect.
    Click Paste to Editor to paste the recorded 4Test code to the editor. Silk Test Classic closes the Record Application State dialog box and places the new application state in your file.
    You want to alter the code.
    Edit the Application State Code field.
    The application state name is not what you want.
    Edit the name in the Application State Name field.
    The application state on which this application state is based is not the one you want.
    Delete the code in the Application State Code field, select a new application state from the list, and click Resume Recording to re-record the application state.
    The application state routine is not finished.
    Click Resume Recording. Silk Test Classic opens the Record Status window.
  10. Click Set Recovery System to specify the base state for the application under test. This button is only available when wMainWindow has not been set, for example if you have referenced an include file that does not contain constwMainWindow = MyWin.