Testing with random inputs and pattern-based testing

It often seems like reinventing the wheel while writing test cases. Always trying to use some handwritten random inputs and trying a few of those inputs on the newly written functions. In this recipe, you will be presented with the Clojure equivalent of QuickCheck patterns, which is a famous testing framework for the Haskell programming language. No need to learn Haskell today, but let's review some cool testing patterns!

Getting ready

In this recipe, one of the main goals is to generate various kinds of data. To achieve that, we will have a mix of handmade data generators and some others will come through libraries. Let's go through the libraries setup.

Libraries

The project.clj file is a bit dense ...

Get Clojure Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.