Skip to content

cdlib/quickcheck-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

quickcheck-demo

Motivation

What do "traditional" unit test look like? What are their limitations?

What is QuickCheck?

"QuickCheck" is a testing library originally written in Haskell (ca. 2000) and is based on Haskell's type system. QuickCheck, a trademarked product, now commonly refers to any property based testing tool, though the term has stuck. Many popular test frameworks have adopted the ideas suggested by QuickCheck, though not all rely on type classes / classical inheritance to generate test cases.

Examples in your language of choice

Demonstration code

This repository demonstrates tests in Java using QuickTheories. The API is easier to work with than traditional JUnit (<=4) theories. How does it compare to JUnit Jupiter and other test frameworks (e.g. Spock: Data Driven Testing)? You can clone this repository and run the tests with Maven.

Key Terms

  • Invariants - properties of a method that do not change with changing object state, or properties that hold for any set of parameters to a stateless method.
  • Generators - producers, typically randomized, of parameters or object state for test cases. Generators may produce more test cases than are actually run at verification. Randomness can typically be configured for determinism (repeatability) or non-determinism (serendipity).
  • Shrinking / Reduction - taking a set of test parameters and attempting to find a simpler, or more general, set of test parameters that achieve the same result, typically a falsification. For example, if ("ABCDEX","YEDCBA") fails a boolean palindrome(a, b) function, then either ("ABC","CBA") or ("DEX", "YED") ought to also fail and is a simpler test case.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages