FsCheck: Random Testing for .NET

FsCheck is a tool for testing .NET 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#, C# or VB, using combinators defined in the FsCheck library. FsCheck provides combinators to define properties, observe the distribution of test data, and define test data generators. When a property fails, FsCheck automatically displays a minimal counter example.

FsCheck, NUnit and xUnit.NET plugin can be installed from NuGet using your favorite package manager.

Users have also created integrations with Expecto, Fuchu, AutoFixture and MSTest that you can find on NuGet.

Warning: Documentation

The Documentation section below was written for version 2.x, but 3.x is the version that is currently maintained. Only v3 will get new features and fixes, even though it's in pre-release.

This leaves us in the unfortunate position that some documentation is out of date and incomplete. One exception is the API docs. They are generated from the 3.x code and are accurate - if in doubt, believe the API docs.

The documentation and API docs for 2.x are not easily accessible anymore. The last commit of the 2.x documentation site is here.

Pleae help fixing this! FsCheck welcoms contributions of all kinds, big or small. See issues for inspiration. Feel free to open an issue to highlight specific documentation problems or gaps, even if you're not sure it really is a problem. At worst you'll get an answer to your question.


Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding new public API, please also consider adding samples that can be turned into documentation.

The library is available under the BSD license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.