When testing an application, you\u2019re likely to have a number of testcases that have identical setup steps. Rather than record the same steps over and over again you can record the steps as an application state and then associate the application state with the relevant testcases.
An application state is the state you want your application to be in after the base state is restored but before you run one or more testcases. By creating an application state, you are creating reusable code that saves space and time. Furthermore, if you need to modify the Setup stage, you can change it once, in the application state routine.
A testcase can have, at most, one application state associated with it. However, that application state may itself be based on another previously defined application state. For example, assume that:
If a testcase is based on a single application state, that application state must itself be based on DefaultBaseState in order for the testcase to use the recovery system. Similarly, if a testcase is based on a chain of application states, the final link in the chain must be DefaultBaseState. In this way, SilkTest\u2019s built-in recovery system is still able to restore the application to its base state when necessary.
Built-in application state function that returns your application to its base state. By default, the built-in DefaultBaseState ensures that the application is running and is not minimized, the main window of the application is open, and all other windows (for example, dialogs and messages boxes) are closed.
If an application state is based on the keyword NONE, SilkTest executes the application state twice: when the testcase with which it is associated is entered and when the testcase is exited.
Appstate InvokeFind () basedon none
testcase TestFind () appstate InvokeFind
print ("In TestFind")
You define an application state before recording the testcase(s) associated with it. As with testcases, you can write an application state routine from scratch or you can use the Application State command on the Record menu.
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 testcases are defined. If you put the application state in the test frame file, it will be available to all testcases. If you put it in the script file, it will be available only to testcases in that script file.
This action might not be possible to undo. Are you sure you want to continue?