Defining States in Eggplant DAI
With Eggplant DAI, you create models of your systems under test (SUTs) so that Eggplant DAI can use its algorithms to generate tests on your system. Models are composed of states and actions. States generally represent the screens within a software application. Actions are the user actions that can be performed within a state, including actions that move users between states.
Below you will find information about creating and using states in Eggplant DAI models. For information about actions, see Actions in Eggplant DAI.
Types of States
Eggplant DAI states can be one of four types:
- Start: This state type is used for the Initial state, or starting point, for your model. This is the first model element that is run when executing a test against your model.
- Exception: This state type is used for the Error state that is added automatically when you create a new model. You can use this state for error handling.
- Cleanup: This state type is used for the Cleanup state that is added automatically when you create a new model. You can use this state for any cleanup steps you want to perform on your SUT at the end of model runs.
- Normal: This state type is used for all other states. Most of your model will be built with the Normal state type.
Default States in a New Model
When you create a new model in Eggplant DAI, the green Start state is placed in the Model workspace automatically with a name of Initial. You can select the State Properties tab in the right pane, then change the state's Name to something that better represents your model.
If you click the Model Tree tab in the left pane, you see that the new model has the following states by default:
- Initial: This is the Start state, the starting point for model runs.
- Error: This state has the type Exception. Eggplant DAI calls this state whenever an error occurs when running a model. An error can occur when a model check fails or when a problem occurs within a SenseTalk snippet. To use error handling in these situations, you need to attach an appropriate SenseTalk snippet to this state. If no snippet is attached when this state is called, the model run exits without taking any action here.
- Cleanup: Eggplant DAI calls this state just before a model run exits. You can use the Cleanup state to tidy up the SUT prior to exiting, if necessary, by attaching an appropriate SenseTalk snippet. For example, you might need to close applications or database connections. If no snippet is attached when this state is called, the model run exits without taking any action here.
- Exit: This state does not contain any actions. When Eggplant DAI calls this state, the model run ends.
Typically, only the Start state and any Normal states you add display on the Model workspace. The Exception, Cleanup, and Exit states appear only in the Model Tree tab.