DEV Community

Nicolas DUBIEN
Nicolas DUBIEN

Posted on • Edited on

3 1

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.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay