Fuzz Your Tests

Selecting test inputs and considering edge cases can consume a lot of testing time. You mainly care that a certain property of a function holds true regardless of the input. For example, after you call addYears, you expect the difference between the old and new dates’ years to equal the argument to addYears.

In this section, you will use fuzz testing to test properties of your date library. You will generate random test input with fuzzers and use the input inside test code. You will discover the pros and cons of fuzz testing and learn when you should use it. You will also create your own fuzzer to randomly generate dates.

Create Your First Fuzz Test

Historically, developers in languages such as C++ and Java use fuzz testing to ...

Get Programming Elm now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.