QuickCheck is an implementation of the QuickCheck specification based test tool.

The goal of QuickCheck is to replace manually picked values with generated values. A QuickCheck-based test tries to cover the laws of a domain whereas classical testing can only test the validity for distinct values.

Basically, QuickCheck is about generators of data. The QuickCheck runner method is just a fancy for loop implementation. QuickCheck can help in scenarios where whole classes of test cases have to be tested and it is not feasible to write tests for all distinct test scenarios.

Generators supported for

  • types (primitive: int, byte, long, String, char, null, boolean; collections: arrays, lists; POJOs)
  • value ranges (integer, chars)
  • lists, sets and arrays
  • distinct values (uniqueValues, ensureValues, fixedValues, enumValues, clonedValues, excludeValues)
  • distributions
  • generator strategies (composition of generator values (oneOf, frequency, list, array, nullsAnd), transformation, mutation)
  • value frequencies (frequency, oneOf)
  • determinism (random, deterministic )



The Quickcheck Javadoc is available here.




The following example test that a sorted list implementation is actual sorted. The values inserted into the list are arbitrary integer values.

public class SortedListTest {

  @Test public void sortedListCreation() {
     for (List<Integer> any : someLists(integers())) {
        SortedList sortedList = new SortedList(any);
        List<Integer> expected = sort(any);
        assertEquals(expected, sortedList.toList());

 private List<Integer> sort(List<Integer> any) {
     ArrayList<Integer> sorted = new ArrayList<Integer>(any);
     return sorted;

More examples can be found in the examples.


QuickCheck 0.6 (zip, javadoc) March 19, 2011 Release notes

QuickCheck 0.5.1 (zip, javadoc) February 17, 2011

QuickCheck 0.5 (javadoc) January 2, 2010 Release notes

QuickCheck 0.4 (javadoc) June 3, 2009

QuickCheck 0.3 (javadoc) March 23, 2008

QuickCheck 0.2 (javadoc) July 23, 2007

QuickCheck 0.1 July 7, 2007


That the following dependecy to your pom file:



Getting started

  1. install Oracle JDK 6
  2. hg clone
  3. ./gradlew test
  4. ./gradlew eclipse
  5. import projects quickcheck-core, quickcheck-examples, quickcheck-src-generator into Eclipse


Project QuickCheck needs help in the following areas:

  • Todos
  • Sample code.
  • The test code in Robert C. Martin's Clean Code offers plenty of opportunities to show Quickheck's strengths.
  • One possibility is to port the code from Alberto Savoia's Beautiful code chapter Beautiful Tests and make it beautiful with Quickcheck

Quickcheck Release Todos

  • fix version number in poms
  • run hudson
  • update todo.txt
  • update changes.txt
  • check javadoc upload javadoc
  • upload assembly zip
  • update index.html (text, like to assembly file)
  • deploy to maven repository
  • tag
  • blog
  • set version number to snapshot