Generating Circumstances

Generating Circumstances

Abstract
----------
Most samples, fixtures, stubs, and repetitive test-cases tend to fall short of completing their intended storyline: representing the range of possible values that will interact with a designated specification, whether that refers to a single function or a more integrated system. Why not just set some bounded constraints and generate a more exhaustive set of circumstances that your program or system is contracted and believed to satisfy? In this talk, through examples in Clojure’s test.check and Erlang’s QuickCheck, I’ll demonstrate how to easily compose and apply generators for various use-cases, including generating data from schema/validation libraries like Clojure’s Prismatic Schema and Herbert and using a finite state machine to model stateful code with side-effects via Erlang QuickCheck’s eqc_statem. We can apply these generations toward all kinds of problem spaces: from testable database environments to property-based tests for capturing what’s true/valid and what better be false.

5cf448e5edc7dc73659e3f42baff490a?s=128

Zeeshan Lakhani

January 09, 2015
Tweet