Back to Overview

Property-based Testing

In this episode of expect(Exception), Tobi Timm talks to Roman and me about property-based testing, how powerful it is, if it has any downsides at all, and which library you can use for Javascript applications. Stay to the end of the episode if you want to know what you could do with your time instead of spending it on writing hundreds of tests manually.

In JavaScript we can use Faker to create sets of input data. But is there a tool for property based testing? There is! While there is QuickCheck for Haskell, Hypothesis for Python, ScalaTest or Scala, fscheck for .NET, junit-quickcheck for Java, and rantly for Ruby, also Javascript has one library to include property-based testing in any Frontend testing tool like Mocha, Jest, Cypress, Playwright: it's fast-check!

Show Notes:

[00:00:00] Intro

[00:01:35] What is property based testing?

[00:03:36] Are there performance issues?

[00:04:44] Property based testing: Example 0-10 items

[00:07:23] Factory Functions to create sets of input data

[00:08:54] When and where to use and run property based tests?

[00:12:42] Value provided by property based testing

[00:14:26] How to convince the managers

[00:18:42] Downsides of property based testing

[00:21:28] Example for a factory method

[00:22:31] Different property based test libraries

[00:26:21] Fastcheck

[00:34:26] Input data to test against

[00:39:55] Picks


Use the code podexcept20 to get a 35% discount on all of the Manning Publications products.

Music from Pixabay

Back to Overview