liveBook · Manning

QuickCheck

As explained in Functional Programming in JavaScript

A Haskell library for property-based testing that generates random test cases from specifications.

QuickCheck is a Haskell library for randomized property-based testing. You describe properties that a pure program should satisfy, and it generates many test cases, reporting which cases pass or fail. section 6.4

Property-based testing with QuickCheck:

  • Starts with a referentially transparent specification rather than a fixed list of examples. section 6.4
  • Generates a large permutation of inputs to exercise possible output paths and expose invalid properties. section 6.4
  • Supports refactoring by checking that new code continues to satisfy the stated properties. section 6.4

JavaScript analogue

JSCheck mirrors QuickCheck by combining a property, generated inputs, and a verdict function. A grade test generates arrays of numbers between 90 and 100, checks that computeAverageGrade returns “A,” and reports 100 passing cases.

How Functional Programming in JavaScript covers it

How deep it goes
Explains specifications, generated cases, reports, and JavaScript integration, but does not detail QuickCheck internals.
Examples
Demonstrates grade classification and Social Security number validation through generated inputs and pass/fail reports.
What it assumes
Assumes pure or referentially transparent functions and clear input conditions, while explaining property-based testing through examples.
What you can do after
Evaluate pure functions by writing properties and reviewing randomized test reports.
How it connects
Connects property-based testing with referential transparency, pure functions, randomized testing, and automated regression checking.

Also explained in

Compare how 3 books explain QuickCheck →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Functional Programming in JavaScript. The section links point to the parts of the book it draws on.