What is FsCheck?

FsCheck is a tool for testing F# programs automatically. The programmer provides a specification of the program, in the form of properties which functions, methods or objects should satisfy, and FsCheck then tests that the properties hold in a large number of randomly generated cases. While writing the properties, you are actually writing a testable specification of your program. Specifications are expressed in F#, using combinators defined in the FsCheck library. FsCheck provides combinators to define properties, observe the distribution of test data, and define test data generators.

FsCheck is a port of Haskell's QuickCheck 0.1. Important parts of the manual for using FsCheck is almost literally "adapted" from the QuickCheck manual and paper. Any errors and omissions are entirely my responsibility.

FsCheck test cases and specifications are currently best written using F#. Non-functional languages like C# and VB.net lack the language features necessary to use FsCheck effectively. FsCheck still might be useful for testing programs written in other languages. The generator combinators can be used in any testing framework to easily generate a number of random values for many types.

Download

Latest: FsCheck 0.3

Documentation
QuickStart
Properties
Test Data Generators
Usage Tips
Known Issues/Troubleshooting

More reading related to FsCheck
  • Matthew Podwysocki has put together an excellent series of blog posts about integrating HUnit, QuickCheck and HPC on the Haskell side, and xUnit, FsCheck and NCover on the F# side. Nice to read if you're interested in an integrated story about testing in F# and/or Haskell:
  • Another interesting read about QuickCheck is in Chapter 11 of the excellent Real world Haskell book. The book is freely available online, but do the authors a favor and buy it, it's really worth it also for F# programmers.
Last edited Dec 30 2008 at 10:54 PM by kurt2001, version 15
Comments
No comments yet.

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | CodePlex Blog | Version 2008.12.9.14291