Excercise 5 - SCTUnit

In the following lesson we will write some SCTUnit tests for the statechart we developed so far. The following scenarios should be tested:

SCENARIO PRE-CONDITION INTERACTIONS POST_CONDITION
Activating and Deactivating the Light Control the states idle and Off are active. 1. Press the button down
2. Wait 400 milliseconds
3. Press the button down again
4. Wait another 400 milliseconds
1. The state clicking should be active after the first pressing down of the button
2. After waiting 400 milliseconds the state On should be active
3. Also the variable wire.power should be DIMMED
4. After pressing the button down again as well as waiting 400 milliseconds the state Off should be active
5. Also the variable wire.power should be OFF
Testing the Motion Control The state Off is active 1. Raise the event sensor.motion
2. Raise the event sensor.motion again
3. Wait 30 seconds
1. The state MotionOn should be active after raising the event sensor.motion
2. Also the varialbe wire.power should be FULL
3. After raising the event another time the state of the statemachine should not have changed
4. After waiting 30 seconds the state OFF should be active
5. Also the variable wire.power should be OFF
Testing the Double-click behavior The states Off and idle are active 1. Bring the statemachine in the state (see scenario 1)
2. Raise the event button.down two times
3. Wait 400 milliseconds
4. Raise the event button.down for another two times
5. Wait another 400 milliseconds
1. The state On should be active after the first double-clicking process
2. Also the variable wire.power should be FULL
3. After the second double-clicking process the state On should still be active
4. The variable wire.power should now be DIMMED instead of FULL