Testcover.com Testcover.com
Tutorial - Thermostat Example -
State Machine Test Models

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
--->Thermostat Example
--->Test Models, 3 Regions
--->Design Procedure
--->tempSet Designs
--->tempControl Designs
--->fanControl Designs
->Definitions of Terms
Performance
WSDL Interface
Background
Partners
Registrations
Contact Information



In the thermostat example four pairwise test models can be applied to the regions of the UML state machine:

• Stand-alone transition model --The region is considered isolated from the rest of the system; each state transition in this region has one partition.
• Integrated transition model --States of other regions are included as factors for testing this region; each state transition in this region has one partition.
• Integrated target state model --States of other regions are included as factors for testing this region; the transitions to each target state in this region are combined into one partition.
• Integrated propagation model --States of other regions are included as test factors; the effects of this region's transitions on other regions are tested.

The stand-alone transition model is the simplest model. It treats the region as unaffected by the states of the other regions unless there is an explicit interaction (as in the fanControl region's dependence on the tempControl state). The stand-alone transition model has one partition for each transition between lowest-level leaf states in the region under test. Test factors include the current from state and the trigger event for the transition to the target to state. (The resulting state change is an expected result, so the to state is not a test factor.) If program variables are needed to specify the extended state of the region, they are additional test factors. Thus, for example, in the tempSet region, there are 5 test factors: 3 variables (roomTemp, heatTemp, and coolTemp), the current tempSet state, and the trigger event causing the transition to the next state.

The number of test cases in the stand-alone transition model can be estimated by multiplying the number of partitions by the number of test cases in one of them. If there are S states in the region, there are no more than S2 transitions. Thus the number of partitions is less than or equal to S2 also. The number of test cases in each partition often is estimated as the product of the numbers of values for the two largest test factors. (If the two largest factors have 5 values and 2 values, 10 test cases are required to cover all their pairs.) In the stand-alone transition model each partition has only 1 value for the current state, so the number of test cases depends highly on the number of trigger events and the numbers of test values for program variables. If the number of test cases can be limited to "a few" in each partition, then the estimated number of test cases for this model is a few times S2.

The integrated transition model is the most comprehensive model for testing a single region, and it typically leads to the most test cases. As above, test factors include the current leaf state and trigger event for this region under test, as well as relevant program variables. In the integrated transition model, the current leaf states of other regions are included as test factors also. Each state transition in this region has one partition, and each partition has a test case covering every pair of other regions' states. Compared with the integrated target state model (below), the integrated transition model calls for additional testing of the effects other regions' states may have on this region.

The number of test cases in the integrated transition model can be estimated by multiplying the number of partitions by the number of test cases in one of them. If there are S states in each of 3 or more regions, there are no more than S2 transitions in the region under test. Thus the number of partitions is less than or equal to S2 also. However the number of test cases in each partition can be estimated to be S2 to include all the pairs of current states from the other regions. Thus the number of test cases is on the order of S4.

The integrated target state model includes the current states of the other regions, but it reduces the number of partitions to yield fewer test cases. The test factors are the same as those for the integrated transition model, including the current leaf state and trigger event for this region, relevant program variables, and the current leaf states of the other regions. The difference is that the integrated target state model defines a partition to include all the transitions leading to a particular target state. While the integrated transition model associates all pairs of other regions' states with each transition, the integrated target state model only guarantees that all pairs of other regions' states are associated with the target state. Note that using the current states of all regions as test factors assures that all pairs of current states leading to the target state are included in test cases.

As above, the number of test cases in the integrated target state model can be estimated by multiplying the number of partitions by the number of test cases in one of them. If there are S states in each of 2 or more regions, there are S target states in the region under test, and the number of partitions is equal to S also. However the number of test cases in each partition can be estimated to be S2 to include all the pairs of current states from all the regions. Thus the number of test cases is on the order of S3.

The integrated propagation model differs from the other 3 models in that its purpose is to test the effects of this region's transitions on other regions. The test factors are the same as those for the integrated target state model, including the current leaf state and trigger event for this region, relevant program variables, and the current leaf states of the other regions. The integrated propagation model also follows the integrated target state model in defining a partition to include all the transitions leading to particular target state. However, in the integrated propagation model, combinations of states, trigger events, and program variable values are selected to test the interactions with other regions.

In some systems it may be important to test for negative results. An example of a negative result is a transition in this region that has no effect on another region. Such tests are beyond the scope of the integrated propagation model, which focuses on testing positive consequences of this region's operation. Thus, blocks from the integrated target state model are not included in the integrated propagation model when they do not affect other regions according to the state machine diagram. Similarly, test factor values which do not cause observable interactions with other regions are excluded. Typically the number of test cases in the integrated propagation model is less than the number in the integrated target state model.

The numbers of test cases resulting from the different designs are tabulated below.

Thermostat State Machine Test Designs
Orthogonal
Region
Stand-alone
Transition Model
Integrated
Transition Model
Integrated
Target State Model
Integrated
Propagation Model
tempSet 65 test cases in
7 partitions
105 test cases in
7 partitions
76 test cases in
3 partitions
34 test cases in
3 partitions
tempControl 64 test cases in
16 partitions
120 test cases in
16 partitions
66 test cases in
5 partitions
40 test cases in
5 partitions
fanControl 15 test cases in
8 partitions
96 test cases in
8 partitions
52 test cases in
3 partitions

It is important to note that for each of the 3 regions the same test factor values (i.e. the same blocks) are used for the integrated transition model design as for the integrated target state model design. Thus the differences in numbers of test cases are due to differences between the models, and not different choices of test values. Test model mappings for the tempSet, tempControl and fanControl regions relate their designs on a block-by-block basis.

<Thermostat Design Procedure>

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