Skip to content

Quviq/quickcheck-dynamic

 
 

Repository files navigation

quickcheck-dynamic

 

A library for testing stateful programs using QuickCheck and dynamic logic.

This repository hosts:

  • The core quickcheck-dynamic library providing tools for quickchecking stateful models,
  • Example of integrating io-sim's Haskell runtime simulator and quickcheck-dynamic to model and test complex multi-threaded application.

Documentation

The following talks provide concrete examples on how this approach is used to test smart contracts in Plutus:

The following blog posts provide some more in-depth educational material on quickcheck-dynamic:

  • Edsko de Vries wrote a nice post to compare quickcheck-dynamic with quickcheck-state-machine, another library to write model-based tests on top of QuickCheck. This blog post introduces quickcheck-lockstep which provides lockstep-style testing on top of quickcheck-dynamic,
  • IOG published an introductory post on quickcheck-dynamic, detailing some rationale and background for this work, and suggesting a step-by-step approach to use it based on some real world experience.

Building

Without nix

This package uses Cabal-based build. To build from source:

  • Ensure both ghc and cabal executables are in your PATH.
    • ghcup is a great way to manage Haskell toolchain.
    • quickcheck-dynamic currently requires a GHC version > 8.10
  • Run
    cabal update && cabal build all
    
  • To run tests:
    cabal test all
    

With nix

This repository comes with some nix files which might or might not help hacking on quickcheck-dynamic simpler. Before you start using nix, please make sure you've configured haskell.nix caching as per those instructions.

  • Building with nix should be as simple as:
    nix-build -A quickcheck-dynamic.components.library
    
  • To enter a shell providing basic development tool:
    nix-shell
    
    This can automated using direnv:
    direnv allow
    
  • Then go back to Without nix instructions

About

A library for stateful property-based testing

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 88.0%
  • Nix 11.9%
  • Shell 0.1%