Generative testing with Spec and Spec Test
clojure.spec.test/check function generates 1000 data values to be used as the inputs to a function, checks that the invocation of the function satisfies its specification, the
fdef. The argument specification,
fdef is used to generate a wide range of results, which are more capable of finding edge cases that fail.
Example: card game
practicalli/spec-generative-testing is a simple card game with specifications that are used for basic generative testing.
- Clojure.org guides: Spec - Generators
- API reference: clojure.spec.gen.alpha
- API reference: clojure.spec.test.alpha
- Video: How to do Stateful Property Testing in Clojure?