From plumatic’s schema to clojure.spec

In a previous blog post, I showed an example of using plumatic’s schema with test.check and test.chuck. With the introduction of Clojure’s new spec library, I thought it would be interesting to revisit that post and port it from schema to spec. The code from this post is available on github.

Overall, the port was relatively straight-forward, though spec took some getting used to. spec provides similar facilities for what I was using in schema. It integrated with both test.check and test.chuck with no significant modifications!

Continue reading “From plumatic’s schema to clojure.spec”

Clojure property-based testing with plumatic’s schema and test.check/chuck

In this post, I’ll give a walk-through of property-based testing in clojure with a few great tools: plumatic’s schema, clojure’s own test.check and another great alternate property-based testing library called test.chuck.

First off, schema is a very nice library. If you have not looked at it yet, you should definitely check it out as a lighter-weight alternative to a full-blown typing solution like core.typed. As of version 1.0, schema now includes support for out-of-the-box generators for any of your schemas. Though experimental, the schema generators have worked really nicely for me so far. In this post, we’ll be using the latest version of test.check (0.9.0 as of this writing). It includes a number of nice new features, so you should definitely upgrade your version if you can.

Continue reading “Clojure property-based testing with plumatic’s schema and test.check/chuck”