Skip to main content

Source code file content

Revision: 464

» Project Revision History

» Checkout URL

repository / www / index.html

Size: 7166 bytes, 1 line
<html>
<head>
<title>QuickCheck</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>
	<a href="https://quickcheck.dev.java.net/">QuickCheck</a> is an implementation of the <a href="http://www.cs.chalmers.se/%7Erjmh/QuickCheck">Haskell QuickCheck</a> specification based test tool.
</p>
<p>
The goal of QuickCheck is to replace scenario-based testing with specification-based testing. 
A QuickCheck-based test tries to cover the laws of a domain whereas classical scenario-based testing 
can only test the validity for heuristically (manually) picked values. In the absence of tools 
that could confirm
the compliance to a specification (like compilers can confirm the validity of source
code for a type system) QuickCheck probes the specification with generated values.
</p>
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. 
(E.g.: "This algorithm has to work for unicode string values of unlimited size.") 

</p>

<p>Generators support different: </p>
	<ul>
		<li> types (<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/PrimitiveGenerators.html">primitive</a>: int, byte, long, String, char, null, boolean; 
		collections: <a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#arrays%28net.java.quickcheck.Generator,%20java.lang.Class%29">arrays</a>, 
		<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#lists(net.java.quickcheck.Generator)">lists</a>; 
		<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/PrimitiveGenerators.html#objects%28java.lang.Class%29">POJOs</a>)
</li>
		<li> value ranges (integer, chars)


</li>
		<li> distinct values (uniqueValues, ensureValues, fixedValues, enumValues, clonedValues, excludeValues)
</li>
		<li> sizes (String, Lists, Arrays)
</li>
		<li>
			<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/distribution/Distribution.html">distributions</a>
		</li>
		<li> generator strategies (composition of generator values (oneOf, frequency, list, array, nullsAnd), <a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/support/AbstractTransformerGenerator.html">transformation</a>, <a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/MutationGenerator.html">mutation</a>)


</li>
		<li> value frequencies (<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#frequency%28net.java.quickcheck.Generator,%20int%29">frequency</a>, <a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#oneOf%28net.java.quickcheck.Generator%29">oneOf</a>)
</li>
		<li> determinism (<a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#frequency%28net.java.quickcheck.Generator,%20int%29">random</a>, <a href="https://quickcheck.dev.java.net/javadoc/net/java/quickcheck/generator/CombinedGenerators.html#ensureValues%28java.util.Collection%29">deterministic</a> )

</li>
	</ul>
	<p>
	
	</p>
	<p></p>
	<p></p>
	<h2><a name="Blog"></a> Blog </h2>
	<p>
		<a href="http://theyougen.blogspot.com/">Blog</a>
	</p>
	<p></p>
	<h2>
		<a name="Javadoc"></a> Javadoc </h2>

The current javadoc can be found <a href="http://quickcheck.dev.java.net/javadoc/overview-summary.html">here</a>.
<p>
</p>
	<h2>
		<a name="Example"></a> Example </h2>
	<p>
The following example asserts that a sorted list implementation is actual sorted. The values inserted into the list are arbitrary integer 
values.
</p>
	<p></p>

	<pre>public class SortedListTest {

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

   private List&lt;Integer&gt; sort(List&lt;Integer&gt; any) {
      ArrayList&lt;Integer&gt; sorted = new ArrayList&lt;Integer&gt;(any);
      Collections.sort(sorted);
      return sorted;
   }
}
</pre>
More example can be found in the <a href="https://quickcheck.dev.java.net/source/browse/quickcheck/trunk/quickcheck-examples/">here</a> or in the assembly.
	<h2>
		<a name="Releases"></a> Releases </h2>
	<p>
		<a href="https://quickcheck.dev.java.net/files/documents/7367/146637/quickcheck.0.5.zip">QuickCheck 0.5</a> January 2, 2010
	</p>	
	<p>
		<a href="https://quickcheck.dev.java.net/files/documents/7367/136039/quickcheck.0.4.zip">QuickCheck 0.4</a> June 3, 2009
	</p>
	<p>
		<a href="https://quickcheck.dev.java.net/files/documents/7367/91163/quickcheck.0.3.zip">QuickCheck 0.3</a> March 23, 2008
	</p>
	<p>
		<a href="https://quickcheck.dev.java.net/files/documents/7367/62485/quickcheck.0.2.zip">QuickCheck 0.2</a> July 23, 2007
	</p>
	<p>	
		<a href="http://quickcheck.dev.java.net/files/documents/7367/61443/quickcheck.0.1.zip">QuickCheck 0.1</a> July 7, 2007
	</p>
	<p></p>

	<p></p>
	<h2>
		<a name="Snapshots"></a> Snapshots </h2>
		
	<p><a href="https://quickcheck.dev.java.net/files/documents/7367/145499/quickcheck-0.5b.zip">QuickCheck 0.5. snapshot 2</a> November 22, 2009</p>	
	<p><a href="https://quickcheck.dev.java.net/files/documents/7367/144990/quickcheck-0.5a.zip">QuickCheck 0.5. snapshot 1</a> November 4, 2009</p>
	<p><a href="https://quickcheck.dev.java.net/files/documents/7367/117842/quickcheck.0.4a.zip">QuickCheck 0.4. snapshot</a> November 23, 2008</p>
 	<p><a href="https://quickcheck.dev.java.net/files/documents/7367/90957/quickcheck.0.3a.zip">QuickCheck 0.3. snapshot</a> March 21, 2008</p>
	<p><a href="https://quickcheck.dev.java.net/files/documents/7367/62062/quickcheck.0.2-snapshot.zip">QuickCheck 0.2. snapshot</a> July 15, 2007</p>
	<p>
	</p>
	<h2>
		<a name="Help"></a> Help </h2>

Project QuickCheck needs help in the following areas:

<p> </p>
	<ul>
		<li> General development <a href="https://quickcheck.dev.java.net/source/browse/quickcheck/trunk/todo.txt?view=markup">help</a>.
</li>
		<li> Sample code.  <ul>
<li> The test code in <a href="http://www.pearsonhighered.com/educator/academic/product/0,3110,0132350882,00.html">Robert C. Martin's Clean Code</a> offers plenty of opportunities to show Quickheck's strengths.

</li>
				<li> One possibility is to port the code from <a href="http://www.junitfactory.com/articles/beautiful-code/BeautifulTests.pdf">Alberto Savoia's Beautiful code chapter Beautiful Tests</a> and make it beautiful with QuickCheck.

</li>
			</ul>
		</li>
		<li> Documentation.
</li>
	</ul>

	<p>
If you are interested please send an email to <strong>blob79 at dev.java.net</strong>.</p>
	<p></p>
	<p></p>
	<p></p>
</html>
 
 
Close
loading
Please Confirm
Close