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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.