DEV Community

Nicolas DUBIEN
Nicolas DUBIEN

Posted on • Edited on

Advent of PBT 2021

Advent is a tailored period to discover and play with new ways to code. This year, let's go for another kind of event for the advent: one dedicated to Property Based Testing via fast-check.


Before starting our serie of 24 days, let's first define what is the aim of Property Based Testing.

The technique came from functional world. The observation that led to it was: whenever we try to cover our code with tests we restrict our set of inputs to a very small subset of all the possibilities (if not negligible). In order to cover more, the idea is to go for random, but in a seeded way and with the ability to reduce the generated values in case of errors. Instead* of covering predefined examples, we will cover properties.

A property can be seen as something like:

for any (x, y, ...)
such that precondition(x, y, ...) holds
predicate(x, y, ...) is true

*Property Based should not be seen as a replacement of classical Example Based Tests, it is just a complementary technique

Before you go further in the #AdventOfPBT, you may probably want to start with a quick hands on fast-check.


Day 1 — subject / solution
Day 2 — subject / solution
Day 3 — subject / solution
Day 4 — subject / solution
Day 5 — subject / solution
Day 6 — subject / solution
Day 7 — subject / solution
Day 8 — subject / solution
Day 9 — subject / solution
Day 10 — subject / solution
Day 11 — subject / solution
Day 12 — subject / solution
Day 13 — subject / solution
Day 14 — subject / solution
Day 15 — subject / solution
Day 16 — subject / solution
Day 17 — subject / solution
Day 18 — subject / solution
Day 19 — subject / solution
Day 20 — subject / solution
Day 21 — subject / solution
Day 22 — subject / solution
Day 23 — subject / solution
Day 24 — subject / solution


More about this serie on @ndubien or with the hashtag #AdventOfPBT.

Top comments (0)