SetAppState Function


Calls the application state function associated with the current test case for execution by the agent on the current machine.


SetAppState ([sAppState] )
Variable Description
sAppState Optional: The name of the application state function. STRING.

Notes (Standalone Testing)

You define application states with the appstate declaration. The definition of 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 below.

Calling SetAppState for a test case, typically in the TestCaseEnter function, executes the application state chain associated with the test case, from the base state up to the highest application state.

SetAppState is called by default when you enter a test case, in the DefaultTestCaseEnter function.

In the following example, the test case uses the application state MyAppState, based on MyBaseState. Calling SetAppState executes the statements in MyBaseState followed by the statements in MyAppState.

Example (Standalone Testing)

appstate MyAppState () basedon MyBaseState
// ... 
appstate MyBaseState ()
// ... 
testcase MyTestCase () appstate MyAppState
// calls DefaultTestCaseEnter, which calls SetAppState 

Notes (Client/Server Testing)

In a multi-client testing environment, you must execute SetAppState for each client. This invocation does not have to be within a test case. However, as with the single application case, you probably will not call this function; you call SetMultiAppStates instead, which calls SetAppState for each connected machine.

Before calling SetMultiAppStates, you must explicitly associate an application state with each machine being tested by the test case; you do this with the SetUpMachine function.

Example (Client/Server Testing)

[-] 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")
	[ ] 
	[ ] SetMultiAppStates () // which calls SetAppState