Search⌘ K
AI Features

Modeling the Circuit Breaker: The Shim Module

Explore how to use a shim module to model the circuit breaker in property-based testing. Understand handling success, error, timeouts, and manual operations in stateful system testing. Gain skills to manage dependencies, timers, and refine command generation for more accurate finite state machine models.

Getting started

For stateful properties, we’d initially started our test suite by defining generators. We then needed to refine them when it came to writing the command generation and ended up writing a shim module. This time around, we’re going to start directly with the shim module. It’s a good opportunity to revisit all kinds of possible calls that can take place.

Since we’re testing the circuit breaker itself, we’ll want to cover these situations:

  • Successful calls and their effect on the internal state of the breaker.
  • Calls ending in errors.
  • Calls ending in
...