When a state machine diagram has more than one region, a useful start- ing point is to test each region as if isolated from the rest of the system.
These stand-alone designs can use the transition model and the target state model described in the previous section. When the behaviors of a region explicitly depend on another region (e.g., its state or a message), corre- sponding factors can be included. However, these stand-alone designs do not address the concurrent operation of the other regions generally.
This section introduces three models for integrated designs, which test each region’s behaviors and its interactions with the other regions. The models are integrated in that states of all regions are included as factors in testing each region. The integrated transition model and the integrated target state model use their respective partitioning as before, but the inte- grated test designs control the states of the other regions as well. The third model, the integrated propagation model, focuses on the observable effects of a region’s transitions on other regions, using fewer test cases. It uses the same partitioning and factors as the integrated target state model. However, the only combinations of values selected are for interactions with visible results in other regions. State machine transitions that have no observable effect in other regions are excluded.
Generally, integrated model test designs are based on corresponding stand-alone designs for each region, with current states of other regions as new factors. A typical first approach is to allow all combinations of states.
However, some combinations may not be feasible if the system design pro- hibits them or makes their set-up too difficult. (The test cases specify all the regions’ states when the event occurs. The risks due to test omissions should be considered if the design is constrained to exclude combinations of states.) After the state combinations are chosen, program variable values are selected for each block, consistent with all the regions’ current states and the corresponding events. Additional detail on the design procedure is given in the Testcover.com tutorial [197].
The test designs described here are for a thermostat (Figure 6.4), simpli- fied for the purpose of this example. The thermostat state machine diagram (Figure 6.5) has three orthogonal (concurrent) regions: The tempSet region
134 ◾ Introduction to Combinatorial Testing
allows the user to set the heating and cooling temperatures. Transitions among the leaf states (idleWait, heatKeyWait, and coolKeyWait) are to be tested. The tempControl region controls the heating and cooling accord- ing to the operating mode selected by the user. Transitions among the leaf states (heatOffWait, heatOnWait, coolOffWait, coolOnWait, and temp- ControlOff) are to be tested. The fanControl region controls the operation of the fan circulating the air. Transitions among the leaf states (autoOff- Wait, autoOnWait, and fanOn) are to be tested.
The numbers of test cases generated in the different thermostat exam- ple designs are shown in Table 6.14. In particular, the tempControl inte- grated target state design has 66 test cases in five partitions. There are 16 allowed state transitions grouped into five partitions according to their target states: heatOffWait, heatOnWait, coolOffWait, coolOnWait, and
FIGURE 6.4 Thermostat panel. The thermostat controls heating, cooling, and fan functions to maintain room temperature according to user settings. Normally, the thermostat displays the current room temperature. The SET button is used to select a state to display and set the temperature for heating or cooling. The temperature setting is changed by pressing the UP or DOWN button. The tem- perature control mode is selected with a sliding switch. In the OFF mode, there is no heating or cooling. In the HEAT mode, the thermostat turns the furnace on when the room temperature is less than the heat setting, and off when the room temperature exceeds the heat setting by a small increment. In the COOL mode, the air conditioner is operated similarly. Control of the air circulation fan is set with a second sliding switch. In the AUTO position, the fan is on whenever the furnace or air conditioner is on. In the ON position, the fan circulates air continually.
FIGURE 6.5 Thermostat state diagram with three regions.
Free ebooks ==> www.Ebook777.com
136 ◾ Introduction to Combinatorial Testing
tempControlOff. In this design, there are seven test factors with values as given in Table 6.15.
The first partition includes all transitions to the heatOffWait state.
There are three possible source states: tempControlOff, heatOffWait, and heatOnWait. The partition consists of three blocks corresponding to the source states, as shown in Table 6.16. The heatOffWait partition yields 12 pairwise test cases given in Table 6.17. This design includes all allowed pairs of current states leading to the target state. Each event value is paired with each of the allowed current states.
The integrated transition design uses the same test factors and values as the integrated target state design for the tempControl region (Table 6.15).
Moreover, the same blocks are used, but with different partitioning. The integrated transition design places the three blocks from Table 6.16 into separate partitions, each associated with a different tempControl source state. In this test design there are respectively 9, 6, and 6 test cases for tran- sitions from the tempControlOff, heatOffWait, and heatOnWait source states to the heatOffWait target state.
The integrated propagation design uses the same test factors as the other two integrated designs. However, values that do not lead to observ- able effects in other regions are omitted. Integrated transition blocks that do not meet the propagation model criterion are not used either. Of the three blocks in Table 6.16, only the third (for the heatOnWait to heatOff- Wait transition) propagates to another region—the fanControl region, and only when it is in the autoOnWait state. The expected transition in the
TABLE 6.14 Numbers of Pairwise Test Cases for the Thermostat Example 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 Source: Courtesy of Testcover.com. www.testcover.com
Note: In each of the three 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. Differences in numbers of test cases are due to differences between the models, not different choices of test values.
www.Ebook777.com
fanControl region is from autoOnWait to autoOffWait. This more restric- tive model leads to six test cases for transitions to the heatOffWait target state.
The example of transitions to the heatOffWait state in the tempControl region illustrates the use of different test models for different purposes.
Integrated designs based on state machines with multiple regions sup- port testing while the states of all regions are controlled. The transition model, target state model, and propagation model offer a choice of designs depending on test goals.