Reporting a State Machine

A State Machine can be used to illustrate how States change during the execution of an application, explicitly describing the transitions from State to State. You can show these State transitions on the Sequence diagrams you generate in Execution Analysis.



See also


Firstly you create a State Machine to model all the valid system states, as a child of the appropriate Class element, and on the State Machine you create the State elements that correspond to any states to be captured for your Class.

You then set constraints in the States to record and map the State changes.

When you record code execution for the Class, you set an option in the Record dialog and browse for the State Machine using the State Transition dialog.

The State Transition dialog presents a list of State Machines for the entire model, in which you locate and select the appropriate diagram (see the Example below).

When you generate the Sequence diagram, it  depicts not only the sequence but changes in State at the various points in the sequence; each Class instance participating in the detection process is displayed with its own lifeline.


State Machines

Recording and Mapping State Changes

Start Recording


Reporting State Transitions


The State Machine below, called Stations, shows the different States within the Melbourne Underground Loop subway system.

A train traveling on the subway network can be stopped at any of the stations represented on the State Machine.

The Stations State Machine is a child of the CTrain Class.




When you browse for the diagram in the State Transition Recorder dialog, the hierarchy shows only the root Package, parent Class and child Sub Machine and diagram; no other model components are listed.