Generating Tests By Describing Properties


Details
Are you tired of the tedious work involved in coming up with data for to test all the edge and corner cases for complicated code? When your test data starts getting bigger than the code its meant to test, it might be time to consider a Property Testing approach. Imagine if your test harness could generate test data for you, and when it finds a failing data set, presents you to the simplest way it can fail your test.
That's the approach popularized by Haskell's QuickCheck library, with adaptations created for over 30 languages. I'll show demonstrations in TypeScript with the fast-check library, starting with simple properties of well-known data structures and functions on them, and move into more complex ideas I've used on real-world projects.

Generating Tests By Describing Properties