Want this course?
When to test: during system design
One of the secrets benefits of Property-Based Testing is that it helps you design a system. Think about it: you've got a bunch of constraints you know you need to operate within, there are certain desired properties, etc. You can encode those as Property-Based Tests and develop a model (not a real implementation) and see what it would take to meet those requirements. Then, you can use your model to test the real system. In this episode, we design an email sending system that needs a very specific kind of idempotency.
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.