Recently IOG and QuviQ released a new library for testing stateful systems called
quickcheck-dynamic. In this blog post we will take a look at this library, and how it relates to
quickcheck-state-machine. We will focus on the state machine testing aspect;
quickcheck-dynamic also has support for dynamic logic, but we will not discuss that here.
Specifically, we will consider how we might do lockstep-style testing with
quickcheck-dynamic. This is a particular approach to testing that we described in great detail in an earlier blog post, An in-depth look at quickcheck-state-machine. We will recap the general philosophy in this new blog post, but we will focus here on the hows, not necessarily the whys; it might be helpful to be familiar with the previous blog post to understand the larger context of what we’re trying to achieve.
We have developed a library called
quickcheck-lockstep which builds on top of
quickcheck-dynamic to provide an abstraction called
InLockstep which provides support for lockstep-style testing. In this blog post we will describe this library in two parts:
- In the first half we will show a test author’s perspective of how to use the abstraction.
- In the second half we show how we can implement the abstraction on top of
Part one will suffice for users who simply want to use
quickcheck-lockstep. Part two serves two purposes:
- It will give an illustrated example of how to use
quickcheck-dynamicfor state based testing. We will use most of the core features of the library to implement our abstraction on top of it.
- Since the goal is to provide the end user with a very similar style of testing that we previously provided for
quickcheck-state-machine(see specifically Test.StateMachine.Lockstep.NAry), the implementation will serve as a good test testbed for comparing the two libraries.