Test type・Semi-normal test in state transition 

23/09/2020Test qualityy

Semi-normal system and abnormal system in the code that controls the state transition

Now let’s change our perspective a bit and look at the quasi-normal and abnormal systems for the code that handles state transitions . The design of the state transition is represented by the state transition diagram and the state battle transition table , but here, let’s consider the following example of the state transition diagram.

There are two normal states, a standby state and a processing state, and one abnormal state, which is an error state , and event-A and event-B switch between the two normal states. A timeout function is implemented in the upper state during processing, and it returns to the standby state after a certain period of time. If event-C occurs in the standby state, an error state occurs, and event-D returns to the standby state.

State transition test design is considered by making a state transition table

When testing the state transitions represented by such a state transition diagram, let’s sort out which tests are quasi-normal and which are abnormal. By the way, the state transition diagram is good for summarizing ideas when designing a normal state transition, but it has the disadvantage that the completeness of the state transition design is difficult to understand. When organizing tests, it is necessary to think based on the completeness of the design, so it is a little difficult to think in the state of the state transition diagram. Therefore, let’s rewrite it into a state transition table that makes it easy to see the completeness of state transitions, which is often used in state transition design reviews.

If you rewrite the upper state transition diagram into the state transition table, it will look like the table below. Longitudinally three states , laterally five events side by side, to each cell a state transition to processing the next time of the event is written is. “State transitions for events that were not clearly defined in that state", which was omitted in the state transition diagram, has also been added. (For example, even if event-B occurs in the standby state, the standby state is maintained without any processing.) And the timeout function activates the timeout function only when jumping into the processing state, so the standby state The cell is undefined because the timeout event does not occur in the or error state.

Normal test and semi-normal test have writing in the cell of the state transition table

In this way, the state transition table clearly shows the combination of all events for all states, so the state transitions are covered and it is easy to review and test design . In this state transition table, the normal state transition is a blue cell that goes back and forth between the standby state and the processing state. And since the process when an error occurs, which was examined at the design stage, is an orange process, this is the state transition of the semi-normal test. Then, the state transition of the abnormal test becomes a yellow process indicating a state that should not occur originally.

The blank part of the state transition table is an abnormal test

Therefore, checking the operation of the blue cell is the normal test , checking the operation of the orange cell is the semi-normal test , and checking the operation of the yellow cell is the abnormal test .

This yellow cell is the case when a timeout occurs in a standby state or an error state where the timer is not started, so it should not occur as long as the device is operating normally. However, for example, external noise gone rewritten the value of the variable that records events on the memory, event -D will rewritten to timeout event, as that abnormality occurs when, for yellow to The situation will occur. Anomalous testing is to confirm that the software works without hanging even in such a state.

Next : Test type・Semi-normal test with hardware control
Back : Test type・Semi-normal test in communication protocol processing
Return to :  Testing is the only way to guarantee software quality