Search⌘ K
AI Features

Laying Out State Machine Properties

Explore the structure of state machine properties in property-based testing. Understand the role of models representing system states, command generators tailored to state transitions, and validation methods that ensure system behavior aligns with expectations. This lesson helps you accurately design and test finite state machines in Elixir using PropEr.

The layout

State machine properties are very similar to regular stateful properties, conceptually speaking. They share the same three major components:

  • A model, which represents what the system should do at a high level.
  • A generator for commands, which represent the execution flow of the program.
  • An actual system, which is validated against our model.

Since FSM properties are really a specialization of stateful properties, the differences are subtle.

%0 node_1 Finite State Machines node_2 Model node_1->node_2 node_3 Commands node_1->node_3 node_4 Validation node_1->node_4
Components of a finite state property

The model

The model for state machine properties keeps the same ...