This describes various testing practices which are in use in the Cardano project, along with examples for reference and links to commonly used libraries.
Unit testing is standard practice in the industry and Cardano is no exception.
tasty: a straightforward testing framework, with many libraries that provide additional functionality
hspec: another testing framework, with a BDD-style specification style
Cardano makes extensive use of property-based testing. We believe it to be an excellent technique that allows us to get much higher testing assurance that we would be able to otherwise.
cardano-ledgeruses QuickCheck to generate both transactions and "traces", in order to test the ledger rules.
QuickCheck: the original property-based testing library
hedgehog: a more recent property-based testing library
quickcheck-dynamic: a library for testing stateful systems using QuickCheck
Often our projects have specifications or research documents as well as an implementation. It is useful to test whether the specification conforms to the implementation. This sort of test suite is also useful if there are multiple implementations, as they can all share the use of the conformance test suite.
- plutus has a hand-written conformance test suite.