Advent of PBT 2021
Tags: challenge, testing, webdev, javascript
Published: 2021-12-01 07:49:45

---
title: Advent of PBT 2021
published: true
description: Advent of Property Based Testing, an Advent of Code dedicated to Property Based Testing
tags: challenge,testing,webdev,javascript
//cover_image: https://direct_url_to_image.jpg
---

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](https://github.com/dubzzz/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](https://twitter.com/search?q=%23AdventOfPBT), you may probably want to start with a quick [hands on fast-check](https://github.com/dubzzz/fast-check/blob/main/documentation/HandsOnPropertyBased.md).

---

Day 1 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-1-3jnm) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-1-solution-1l5l)
Day 2 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-2-4gmg) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-2-solution-367b)
Day 3 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-3-4mac) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-3-solution-366l)
Day 4 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-4-3m6g) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-4-solution-lh2)
Day 5 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-5-3227) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-5-solution-6e2)
Day 6 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-6-4lpo) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-6-solution-f7n)
Day 7 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-7-2e89) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-7-solution-4lf3)
Day 8 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-8-2n83) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-8-solution-4c2j)
Day 9 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-9-55na) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-9-solution-58dp)
Day 10 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-10-3dg6) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-10-solution-3a3d)
Day 11 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-11-422p) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-11-solution-1og1)
Day 12 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-12-351b) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-12-solution-3oic)
Day 13 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-13-21e5) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-13-solution-3bhn)
Day 14 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-14-330h) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-14-solution-577o)
Day 15 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-15-3bd) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-15-solution-5ako)
Day 16 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-16-2hma) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-16-solution-3a4c)
Day 17 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-17-3p8b) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-17-solution-3gfe)
Day 18 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-18-365h) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-18-solution-28h3)
Day 19 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-19-37ee) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-19-solution-e57)
Day 20 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-20-31a3) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-20-solution-43nm)
Day 21 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-21-4186) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-21-solution-3j1m)
Day 22 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-22-313c) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-22-solution-2kho)
Day 23 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-23-52e5) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-23-solution-4lg4)
Day 24 — [subject](https://dev.to/dubzzz/advent-of-pbt-2021-day-24-2377) / [solution](https://dev.to/dubzzz/advent-of-pbt-2021-day-24-solution-53e)

---

More about this serie on [@ndubien](https://twitter.com/ndubien) or with the hashtag [#AdventOfPBT](https://twitter.com/search?q=%23AdventOfPBT).