Must know something of everything and everything of something!
State Diagrams
上一篇 /
下一篇 2007-03-30 15:28:51
/ 个人分类:Testing
State Diagrams51Testing软件测试网
^6C:MNw0{7\7I
51Testing软件测试网J3? R9F
f,[State diagrams are used to describe the behavīor of a system. State diagrams describe all of the possible states of an object as events occur. Each diagram usually represents objects of a single class and track the different states of its objects through the system.
(wl?|#}
T0When to Use: State Diagrams
51Testing软件测试网&]r/~*S"m*fUse state diagrams to demonstrate the behavīor of an object through many use cases of the system. Only use state diagrams for classes where it is necessary to understand the behavīor of the object through the entire system. Not all classes will require a state diagram and state diagrams are not useful for describing the collaboration of all objects in a use case. State diagrams are other combined with other diagrams such asinteraction diagramsandactivity diagrams.151Testing软件测试网
BS8F^C~;Px-v
How to Draw: State Diagrams
51Testing软件测试网0Dmf,~I:buqNState diagrams have very few elements. The basic elements are rounded boxes representing the state of the object and arrows indicting the transition to the next state. The activity section of the state symbol depicts what activities the object will be doing while it is in that state. 51Testing软件测试网^P8As
@
51Testing软件测试网-zs}T E%K v51Testing软件测试网YB*~9BYBG
#\(af4\L'q(|d0All state diagrams being with an initial state of the object. This is the state of the object when it is created. After the initial state the object begins changing states. Conditions based on the activities can determine what the next state the object transitions to.51Testing软件测试网N){@7u6E0ua_/a
)`A*j7HX/LB1\F051Testing软件测试网_u]0^O)d
51Testing软件测试网G{)Qg+K)h&uBelow is an example of a state diagram might look like for an Order object. When the object enters the Checking state it performs the activity "check items." After the activity is completed the object transitions to the next state based on the conditions [all items available] or [an item is not available]. If an item is not available the order is canceled. If all items are available then the order is dispatched. When the object transitions to the Dispatching state the activity "initiate delivery" is performed. After this activity is complete the object transitions again to the Delivered state.
r&Y)hnQ%d1v;sC1s051Testing软件测试网D0G-j2~
k v~X8ME)n2f;qJA*T0
51Testing软件测试网e7p+t9^5F/`"~n+iState diagrams can also show a super-state for the object. A super-state is used when many transitions lead to the a certain state. Instead of showing all of the transitions from each state to the redundant state a super-state can be used to show that all of the states inside of the super-state can transition to the redundant state. This helps make the state diagram easier to read.
~)Fd
a
p p @0?p.o0 v-jN4Jtl'Uf8n0The diagram below shows a super-state. Both the Checking and Dispatching states can transition into the Canceled state, so a transition is shown from a super-state named Active to the state Cancel. By contrast, the state Dispatching can only transition to the Delivered state, so we show an arrow only from the Dispatching state to the Delivered state. 51Testing软件测试网qp1lJ` E
(pdp1gis0
'[ ?!rs;z}0
收藏
举报
TAG:
UML