In the previous post, we explained what is model testing. One of the oracles based on model testing is State Model Oracle. The post is aligned with the Black Box Software Testing Foundations course (BBST) designed by Rebecca Fiedler, Cem Kaner, and James Bach.
We model a program as a state machine. At any time program is in a state, and using input, it transits to another state. The test verifies the current program state, provides input and verifies program new state.
A simple example is the state diagram for a door that could only be opened or closed:
State Model is visualized using a state transition diagram. Based on the state transition diagram, the tester can calculate full coverage of possible transitions, using graph theory.
The state machine diagram could become very complex, with a significant number of transitions. Maintenance becomes hard. Transitions considered impossible are not part of the test. An example is loop action to the same state that could have a great number of repetitions. Errors not related to state transitions could become invisible to the tester.