Want this course?
Testing with Spec: custom generators
Clojure Spec integrates with test.check and uses it for testing. When you create a spec, Clojure Spec will try to construct a generator for you. Sometimes it can't do that, so you need to know how to coerce it into making one. And sometimes the generator isn't satisfying, so you need to replace it with another one. In this lesson, we go over the best practices for customizing generators with Clojure Spec.
Testing with Spec: functions
Spec lets you define function specs, which give you a great place to spec the arguments and return values of functions. In addition, you can define invariants that need to be true between the arguments and return values. A lot of your test.check tests will be able to go right in there. Algebraic properties, though, will not. In this second lesson about Spec integration, we go over how Spec can run automated tests of your functions, how to integrate it in a simple way with clojure.test, and the limits of the Spec tests.