SetBaseState Function

Action

Calls the base state function associated with the current machine.

Syntax

SetBaseState ([sAppState])
Variable Description
sAppState

Optional: The name of the application state function. STRING.

If SetBaseState is used and no application state is provided, the test script will not navigate to the sLocation as the appstate DefaultBaseState does.

Notes

You can use SetBaseState without the optional argument sAppState when you are testing a single application from a test case. However, the DefaultTestCaseExit function automatically calls SetBaseState when you exit the test case, so it is rarely necessary to call this function. In a multi-client testing environment you must execute SetBaseState for each client. This invocation does not need to be within a test case. However, as with the single application case, you probably will not call this function. You may need to call SetMultiBaseStates, which calls SetBaseState for each connected machine, but SetMultiBaseStates is also called automatically.

As shown in the example, you define application states with the appstate declaration. The definition for an application state can be based on another application state, which can be based on another, and so on. The base state is the lowest level of application state in this chain of inheritance.

You associate an application state with a test case when you declare the test case, as shown in the test case declaration in the example. In the client/server environment, you must explicitly associate an application state with each machine being tested by the test case; you do this with the SetupMachine function.

Calling SetBaseState for a test case executes the statements associated with the base state—that is, the application state at the bottom of the appstate chain.

In the example below, the test case uses the application state MyAppState, based on MyBaseState. Calling the SetBaseState function executes only the statements in MyBaseState.

Example

[ ] appstate MyAppState () basedon MyBaseState
[-] // Code to bring the application to the proper state... 
	[ ] 
[ ] appstate MyBaseState ()
[-] // Code to bring the application to the base state...
	[ ]  
[-] multitestcase MyTestCase (LIST OF STRING lsMachine)
	[ ] for each sMachine in lsMachine
	[ ] SetUpMachine (sMachine, Design, "MyAppState")
	[ ] 
	[ ] // Call SetMultiAppStates, which calls 
	[ ] // SetAppState ("MyAppState") 
	[ ] SetMultiAppStates ()  
	[ ] 
	[ ] // Body of testcase goes here ...  
	[ ] 
	[ ] // The exiting testcase calls DefaultMultiTestCaseExit, 
	[ ] // which calls SetBaseState ("MyBaseState")