Testcover.com Testcover.com
Tutorial - UML State Machines -
Test Design Procedure

Home
Existing User Login
Brochure
Sign up for Risk-Free Trial
About Testcover.com
Frequently Asked Questions
Tutorial with Examples
->Equivalence Partitioning
->UML State Machines
--->Shopping Cart Example
--->Test Models, 1 Region
--->Thermostat Example
--->Test Models, 3 Regions
--->Design Procedure
->Definitions of Terms
Performance
WSDL Interface
Background
Partners
Registrations
Contact Information





The procedure for generating pairwise test designs from UML state machines is described below. Examples from the thermostat state machine diagram illustrate the steps. Steps 1-6 describe the construction of a stand-alone transition design, steps 7-11 an integrated transition design, steps 12-14 an integrated target state design, and steps 15-18 an integrated propagation design.

When there is only one region, as in the shopping cart diagram, the transition model and the target state model are both "stand-alone." In this case, steps 1-6 describe the construction of a transition design, and steps 12-14 a target state design.

Procedure stepExample


1. Select the region to test and identify its lowest-level leaf states. In the tempSet region there are 3 leaf states: idleWait, heatKeyWait, and coolKeyWait.
2. Identify the state transitions to each of these states. These transitions will define the partitions for the stand-alone transition model and the integrated transition model. In the tempSet region there are 7 state transitions corresponding to partitions:
    # idleWait to idleWait
    # heatKeyWait to idleWait
    # coolKeyWait to idleWait
    # idleWait to heatKeyWait
    # heatKeyWait to heatKeyWait
    # heatKeyWait to coolKeyWait
    # coolKeyWait to coolKeyWait
3. Identify the test factors for the stand-alone transition model. These include program variables (if any), the current from state before the transition, and the event that triggers the transition. In the tempSet region there are 3 program variables:
    - roomTemp
    - heatTemp
    - coolTemp
These, together with the tempSet state and the event, are the 5 test factors in the tempSet stand-alone transition design request.
Thermostat Example - tempSet stand-alone transition design
roomTemp
heatTemp
coolTemp
tempSet state
event
4. For each transition, select test factor values to create a partition using DPB notation. Program variable values should exercise guard conditions and test boundary values. The current state is the leaf state before the transition; the event values are the triggers to the leaf state after the transition. In the tempSet stand-alone transition design request the third partition is for the coolKeyWait to idleWait transition.
#TS:CI coolKeyWait to idleWait
50 99
50 99
50 51 74 98 99
coolKeyWait
C_KEY_TIMEOUT SET
The roomTemp and heatTemp variables have the values 50 and 99. The coolTemp variable has 5 values: 50, 51, 74, 98, 99. The tempSet state is coolKeyWait, and the event has two values, C_KEY_TIMEOUT (triggering a return to IdleWait after a timeout) and SET (triggering a return to IdleWait by a button press).

The partition prefix TS:CI indicates the region, tempSet (TS), and the transition, coolKeyWait to idleWait (CI), for each test case.

5. Use multiple blocks in a partition as needed to test guard conditions and conform to design constraints. In the tempSet stand-alone transition design request the fifth partition, for heatKeyWait to heatKeyWait, has 3 blocks.
#TS:HH heatKeyWait to heatKeyWait
50 99
51 74 98
50 99
heatKeyWait
UP[heatTemp<maxTemp] DOWN[heatTemp>minTemp]
+ internal transition down
49
50
99
heatKeyWait
DOWN[heatTemp<=minTemp]
+ internal transition up
100
99
50
heatKeyWait
UP[heatTemp>=maxTemp]
The first block allows for normal raising and lowering of the heatTemp setting. The second and third blocks check the lower and upper limits of the heatTemp range.
6. If there are functionally dependent factors, use the fixed values procedure as applicable. Submit the request for the stand-alone transition design. Review and refine the design as needed. The tempSet stand-alone transition design results contain 7 partitions with a total of 65 test cases.


7. For an integrated transition design, use the same transitions to define the partitions as in step 2 above. In the tempSet region there are 7 state transitions corresponding to partitions:
    # idleWait to idleWait
    # heatKeyWait to idleWait
    # coolKeyWait to idleWait
    # idleWait to heatKeyWait
    # heatKeyWait to heatKeyWait
    # heatKeyWait to coolKeyWait
    # coolKeyWait to coolKeyWait
8. Identify the test factors for the integrated transition model. These include program variables (if any), the current from states of all regions before the transition, and the event that triggers the transition in the region under test. In the tempSet region there are 3 program variables:
    - roomTemp
    - heatTemp
    - coolTemp
These, together with the tempSet, tempControl, and fanControl states, as well as the tempSet event, are the 7 test factors in the tempSet integrated transition design request.
Thermostat Example - tempSet integrated transition design
roomTemp
heatTemp
coolTemp
tempSet state
tempControl state
fanControl state
event
9. For each partition, select combinations of other region's current states to test this transition. A typical first approach is to allow all combinations of states. However some combinations may not be feasible if the system design prohibits them or makes their set-up too difficult. The risks due to test omissions should be considered if the design is constrained to exclude combinations of states.

Start with the stand-alone transition request and consider each block with the other regions' states as new factors. If some combinations are not feasible, adjust or split the block to allow testable combinations.

In the tempSet stand-alone transition design request the third partition is for the coolKeyWait to idleWait transition. The block in this partition, with the other regions' states added, would be:
#TS:CI coolKeyWait to idleWait
roomTemp_values
heatTemp_values
coolTemp_values
coolKeyWait
heatOffWait heatOnWait coolOffWait coolOnWait tempControlOff
autoOffWait autoOnWait fanOn
C_KEY_TIMEOUT SET
The block above allows all combinations of the other regions' states. It includes combinations designed to persist, e.g. heatOnWait with autoOnWait, when the furnace and fan are both on. And it includes transient combinations, such as heatOffWait with autoOnWait, before the fanControl region has responded to the tempControl state change. There may be testability issues in setting up transient combinations to test the tempSet region.

If the designer decides to test the tempSet region only with the persistent combinations, the block may be split into 2, for off and on operation, as follows.
#TS:CI coolKeyWait to idleWait
+ coolKeyWait to idleWait (Off)
roomTemp_values
heatTemp_values
coolTemp_values
coolKeyWait
heatOffWait coolOffWait tempControlOff
autoOffWait fanOn
C_KEY_TIMEOUT SET
+ coolKeyWait to idleWait (On)
roomTemp_values
heatTemp_values
coolTemp_values
coolKeyWait
heatOnWait coolOnWait
autoOnWait fanOn
C_KEY_TIMEOUT SET

10. For each block in the partition, select program variable values consistent with all the regions' current states to set up the state transition in the region under test. In the tempSet integrated transition design request the third partition is for the coolKeyWait to idleWait transition. It has two blocks with temperature values set respectively for off and on operation of the furnace and air conditioner.
#TS:CI coolKeyWait to idleWait
+ coolKeyWait to idleWait (Off)
70 78
50 51
98 99
coolKeyWait
heatOffWait coolOffWait tempControlOff
autoOffWait fanOn
C_KEY_TIMEOUT SET
+ coolKeyWait to idleWait (On)
70 78
98 99
50 51
coolKeyWait
heatOnWait coolOnWait
autoOnWait fanOn
C_KEY_TIMEOUT SET
11. If there are functionally dependent factors, use the fixed values procedure as applicable. Submit the request for the integrated transition design. Review and refine the design as needed. The tempSet integrated transition design results contain 7 partitions with a total of 105 test cases.


12. For an integrated target state design, each partition will include all the transitions leading to one target state. In the tempSet region there are 3 target states corresponding to partitions:
    # all tempSet states to idleWait
    # all tempSet states to heatKeyWait
    # all tempSet states to coolKeyWait
13. Starting with the integrated transition design request, combine the partitions leading to the same target state. If the partitions for each target state have been grouped together, they can be combined by removing all but the first pound (#) character (which starts a partition). Be sure to use a plus (+) character (which starts a block) where the pound (#) character has been removed. The tempSet integrated transition design request has been changed to an integrated target state design request by combining the partitions leading to the same target state:
    # idleWait to idleWait
    + heatKeyWait to idleWait
    + coolKeyWait to idleWait
    # idleWait to heatKeyWait
    + heatKeyWait to heatKeyWait
    # heatKeyWait to coolKeyWait
    + coolKeyWait to coolKeyWait
14. If there are functionally dependent factors, use the fixed values procedure as applicable. Submit the request for the integrated target state design. Review and refine the design as needed. The tempSet integrated target state design results contain 3 partitions with a total of 76 test cases.


15. For an integrated propagation design, start with the integrated target state design for this region. For each block consider whether the combinations of states and events have effects on other regions according to the UML state machine diagram. If the effects of the block do not propagate to other regions, do not include it in the integrated propagation design. In the tempSet integrated target state design request, blocks 1 & 2 of partition 2 test transitions from the idleWait state to the heatKeyWait state:
#TS:H tempSet states to heatKeyWait
+ idleWait to heatKeyWait (Off)
70 78
50 51
98 99
idleWait
heatOffWait coolOffWait tempControlOff
autoOffWait fanOn
SET
+ idleWait to heatKeyWait (On)
70 78
98 99
50 51
idleWait
heatOnWait coolOnWait
autoOnWait fanOn
SET
The transition represented by these blocks does not affect the tempControl or fanControl region according to the UML state machine diagram. This is true regardless of the values of the program variables, which do not change as a result of the transition. Therefore, the blocks are not included in the integrated propagation design.
16. For each block which may have effects on other regions, consider whether there are combinations of states which would prevent the effects of this transition to propagate. If so, adjust the block to include the positive effects only. In the tempSet integrated target state design request, block 1 of partition 1 tests transitions from the idleWait state to the idleWait state:
#TS:I tempSet states to idleWait
+ idleWait to idleWait (Off)
70 78
50 51
98 99
idleWait
heatOffWait coolOffWait tempControlOff
autoOffWait fanOn
IDLE_TIMEOUT
If the tempControl state is heatOffWait or coolOffWait, and the roomTemp value changes to an on value while the tempSet state is idleWait, there will be an effect from this transition on the tempControl region. If the tempControl state is tempControlOff, there will not be an effect on the other regions. Thus, the tempControlOff value is dropped from this block in the integrated propagation design.
17. For each block which may have effects on other regions, select combinations of program variable values consistent with all the regions' current states to set up the state transition. In the tempSet integrated propagation design request, block 1 of partition 1 tests the corresponding transitions from the idleWait state to the idleWait state:
#TS:I tempSet states to idleWait
+ idleWait to idleWait
70 78
98 99
50 51
idleWait
heatOffWait coolOffWait
autoOffWait fanOn
IDLE_TIMEOUT
On heat and cool temperature values are selected for this block of the integrated propagation design.
18. If there are functionally dependent factors, use the fixed values procedure as applicable. Submit the request for the integrated propagation design. Review and refine the design as needed. The tempSet integrated propagation design results contain 3 partitions with a total of 34 test cases.

<Thermostat Test Models tempSet Stand-alone Transition>

Copyright © 2003-2017 Testcover.com, LLC. All rights reserved.